diff --git a/odex25_takaful/odex_takaful/models/account_move.py b/odex25_takaful/odex_takaful/models/account_move.py
index e19210816..a102f82a2 100644
--- a/odex25_takaful/odex_takaful/models/account_move.py
+++ b/odex25_takaful/odex_takaful/models/account_move.py
@@ -19,7 +19,7 @@ class AccountMove(models.Model):
def action_view_esterdad_id(self):
self.ensure_one() # Ensure the method is called on a single record
action = self.env.ref('odex_takaful.view_esterdad_wizard_tree').read()[0]
- action['domain'] = [('id', '=', self.cancel_record_id.id)]
+ action['domain'] = [('id', '=', self.esterdad_id.id)]
action['context'] = {
'create': False
}
diff --git a/odex25_takaful/odex_takaful/models/donation_details_lines.py b/odex25_takaful/odex_takaful/models/donation_details_lines.py
index 7e7d1a351..aca5ba58f 100644
--- a/odex25_takaful/odex_takaful/models/donation_details_lines.py
+++ b/odex25_takaful/odex_takaful/models/donation_details_lines.py
@@ -21,6 +21,7 @@ class DonationsDetailsLines(models.Model):
journal_id = self.env.company.sponsorship_direct_debit_journal_id.id
return journal_id if journal_id else False
+
name = fields.Text(string="Note")
display_type = fields.Selection([
('line_section', "Section"),
@@ -55,7 +56,7 @@ class DonationsDetailsLines(models.Model):
family_domain_ids = fields.Many2many('grant.benefit', compute='_compute_family_domain_ids')
benefit_id = fields.Many2one('family.member', string='Beneficiary Name', ondelete='restrict', domain="[('id', 'in', members_domain_ids)]", tracking=True)
family_id = fields.Many2one('grant.benefit', string='Family', ondelete='restrict', domain="[('id', 'in', family_domain_ids)]", tracking=True)
- benefit_ids = fields.Many2many('family.member', string='Beneficiaries Names', tracking=True, domain="[('id', 'in', members_domain_ids) , ('age' , '<' , ages)]")
+ benefit_ids = fields.Many2many('family.member', string='Beneficiaries Names', tracking=True, domain="[('id', 'in', members_domain_ids) ]")
sponsorship_duration = fields.Selection([('temporary', 'Temporary'), ('permanent', 'Permanent')],
string='Sponsorship Type', default="temporary")
start_date = fields.Date(string="Sponsorship Start Date", copy=False, default=fields.Date.today())
@@ -67,7 +68,7 @@ class DonationsDetailsLines(models.Model):
benefits_count = fields.Integer(string='Benefits Count', compute='_get_benefits_count')
total_donation_amount = fields.Float(string='Total Donation Amount', compute='_get_total_donation_amount')
total_months_amount = fields.Float(string='Total Months Amount', compute='_get_total_months_amount')
- currency_id = fields.Many2one('res.currency', string='Currency',
+ currency_id = fields.Many2one('res.currency', string='Currency',
default=lambda self: self.env.company.currency_id, readonly=True)
sponsorships_computed = fields.Boolean(copy=False, readonly=True)
direct_debit = fields.Boolean(string='Direct Debit')
@@ -79,7 +80,7 @@ class DonationsDetailsLines(models.Model):
sponsor_phone = fields.Char(related='sponsor_id.mobile')
branch_custom_id = fields.Many2one('branch.settings', compute='_compute_branch_custom_id')
record_type = fields.Selection([('sponsorship', 'Sponsorship'),('donation', 'Donation')], compute='_compute_record_type', store=True, readonly=True)
- state = fields.Selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('waiting', 'Waiting'), ('active', 'Active'),('closed', 'Closed'),('extended', 'Extended'),('replace', 'To Replace'), ('paid', 'Paid')], string='State', default='draft')
+ state = fields.Selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('waiting', 'Waiting'), ('active', 'Active'),('closed', 'Closed'),('extended', 'Extended'),('replace', 'To Replace'), ('paid', 'Paid'),('cancel', 'Canceled')], string='State', default='draft')
sponsorship_scheduling_line_ids = fields.One2many('sponsorship.scheduling.line', 'donation_detail_linked_id')
extension_history_ids = fields.One2many('donation.extension.history', 'donation_detail_id',
string='Extension History')
@@ -147,18 +148,20 @@ class DonationsDetailsLines(models.Model):
store=False
)
- @api.depends()
+ @api.depends('sponsorship_mechanism_id.create_uid')
def _compute_can_edit_benefit(self):
for rec in self:
user = self.env.user
+ print('User , >>>> ' , user )
is_manager = (
user.has_group('odex_takaful.sponsorship_system_manager_group') or
user.has_group('odex_takaful.branch_manager_group'))
- rec.can_edit_benefit = (rec.create_uid == user and not is_manager)
+ print('is_manager >>>>> ' , is_manager)
+ print('rec.create_uid >>>>> ' , rec.create_uid)
+ rec.can_edit_benefit = (rec.create_uid == user and is_manager)
@api.depends('sponsorship_duration', 'payment_month_count', 'direct_debit')
def _compute_age_category(self):
for rec in self:
- print( rec.sponsorship_duration , ' ' ,rec.direct_debit , ' ' , rec.payment_month_count)
if rec.sponsorship_duration == 'permanent':
rec.age_category = 'all'
elif rec.sponsorship_duration != 'permanent' :
@@ -270,7 +273,7 @@ class DonationsDetailsLines(models.Model):
def _compute_branch_custom_id(self):
for rec in self:
rec.branch_custom_id = rec.sponsorship_id.branch_custom_id or rec.sponsorship_mechanism_id.branch_custom_id
-
+
@api.depends('direct_debit', 'end_date')
def _compute_show_extend_button(self):
today = fields.Date.today()
@@ -712,11 +715,12 @@ class DonationsDetailsLines(models.Model):
domain = []
if rec.record_type == 'sponsorship':
domain = [
- '|',
+ '|',
('state', '=', 'second_approve'),
- '&',
+ '&','&',
('state', 'in', ('waiting_approve', 'first_approve')),
- ('action_type', '=', 'suspended')]
+ ('action_type', '=', 'suspended'),
+ ('age', '<', rec.ages)]
domain = expression.AND([domain, [
('member_status', '=', 'benefit'),
@@ -728,18 +732,18 @@ class DonationsDetailsLines(models.Model):
domain = expression.AND([domain, [
('benefit_id.code', '=', rec.benefit_family_code)
]])
-
+
if rec.age_category_id:
domain = expression.AND([domain, [
('age', '<=', rec.age_category_id.max_age),
('age', '>=', rec.age_category_id.min_age)
]])
-
+
if rec.education_level:
domain = expression.AND([domain, [
('education_levels', '=', rec.education_level.id)
]])
-
+
if rec.education_status:
domain = expression.AND([domain, [
('education_status', '=', rec.education_status)
@@ -770,7 +774,7 @@ class DonationsDetailsLines(models.Model):
domain = expression.AND([domain, [
('relationn.relation_type', '=', 'son')
]])
-
+
if rec.benefit_id_number:
domain = expression.AND([domain, [
('member_id_number', '=', rec.benefit_id_number)
@@ -826,6 +830,7 @@ class DonationsDetailsLines(models.Model):
if record_type == 'donation':
domain.append(('donation_category', '=', 'donation'))
+ domain.append(('donation_category', '=', 'endowment'))
elif record_type == 'sponsorship':
domain.append(('donation_category', '=', 'sponsorship'))
@@ -835,6 +840,7 @@ class DonationsDetailsLines(models.Model):
'domain': {
'product_template_id': domain}
}
+
@api.onchange('donation_type')
def onchange_donation_type(self):
diff --git a/odex25_takaful/odex_takaful/models/donation_extension_history.py b/odex25_takaful/odex_takaful/models/donation_extension_history.py
index b2f487273..cf76313f9 100644
--- a/odex25_takaful/odex_takaful/models/donation_extension_history.py
+++ b/odex25_takaful/odex_takaful/models/donation_extension_history.py
@@ -104,7 +104,8 @@ class DonationExtensionHistory(models.Model):
string='New Direct Debit',
readonly=True
)
-
+ state = fields.Selection([ ('active', 'Active'),('cancel', 'Canceled')], string='State', default='active')
+ canceled = fields.Boolean()
@api.depends('donation_detail_id', 'extension_date')
def _compute_extension_ref(self):
for rec in self:
diff --git a/odex25_takaful/odex_takaful/models/res_partner.py b/odex25_takaful/odex_takaful/models/res_partner.py
index bb21ce779..274150833 100644
--- a/odex25_takaful/odex_takaful/models/res_partner.py
+++ b/odex25_takaful/odex_takaful/models/res_partner.py
@@ -309,6 +309,18 @@ class ResPartner(models.Model):
if self.kafel_id:
self.kafel_id.login = vals['mobile']
+ if 'mobile' in vals and self.mobile != False:
+ kafeel = self.env['res.users'].with_user(2).create({
+ 'name' : vals['name'],
+ 'branch_custom_id':vals['branch_custom_id'],
+ 'sel_groups_1_9_10' : 9,
+ 'partner_id' : self.id,
+ 'login' : vals['mobile'],
+ 'otp_mobile_phone' : vals['mobile'],
+ 'otp_enabled' : True,
+ })
+ self.kafel_id = kafeel
+
res = super(ResPartner, self).write(vals)
return res
diff --git a/odex25_takaful/odex_takaful/models/takaful_sponorship_model.py b/odex25_takaful/odex_takaful/models/takaful_sponorship_model.py
index 1322c5c35..589e07083 100644
--- a/odex25_takaful/odex_takaful/models/takaful_sponorship_model.py
+++ b/odex25_takaful/odex_takaful/models/takaful_sponorship_model.py
@@ -130,7 +130,12 @@ class TakafulSponsorship(models.Model):
pay_date = fields.Datetime()
cancel_record_id = fields.Many2one('esterdad.wizard', string="Cancel Record")
record_url = fields.Char(string="Record URL", readonly=True)
+ is_canceled_refund = fields.Boolean()
+ @api.depends('is_canceled_refund')
+ def cancel_refund_tamded(self):
+ for rec in self:
+ print('Hi')
def action_quotation_send(self):
self.ensure_one()
diff --git a/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml b/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml
index a8bdfcec4..e28b6782a 100644
--- a/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml
+++ b/odex25_takaful/odex_takaful/views/donation_extension_history_views.xml
@@ -27,7 +27,12 @@
donation.extension.history