Merge branch 'dev_odex25_takaful' of https://github.com/expsa/odex25-standard-modules into create_partner_bank_api
This commit is contained in:
commit
5ecb07f1b3
|
|
@ -7,6 +7,7 @@ __pycache__/
|
|||
# C extensions
|
||||
*.so
|
||||
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
|
|
|
|||
|
|
@ -126,6 +126,13 @@ class DonationsDetailsLines(models.Model):
|
|||
compute="_compute_direct_debit_filter", store=True,
|
||||
)
|
||||
|
||||
|
||||
@api.onchange('family_id')
|
||||
def onchange_family_id(self):
|
||||
for rec in self:
|
||||
rec.benefit_ids = False
|
||||
|
||||
|
||||
@api.depends('benefit_id.diseases_attachment_ids')
|
||||
def _compute_get_diseases(self):
|
||||
for rec in self:
|
||||
|
|
|
|||
|
|
@ -102,13 +102,30 @@ class ResPartner(models.Model):
|
|||
)
|
||||
kafel_state = fields.Selection([
|
||||
('active', "Active"),
|
||||
('not_active', "Not Active")] ,string='Status')
|
||||
('not_active', "Not Active")] ,string='Status' , compute="get_sponser_state", store=True)
|
||||
|
||||
|
||||
_sql_constraints = [
|
||||
('id_number_uniq', 'unique (id_number)', 'The ID Number Already Exist!'),
|
||||
]
|
||||
|
||||
|
||||
@api.depends('donation_line_ids.state', 'donation_line_ids.sponsorship_duration')
|
||||
def get_sponser_state(self):
|
||||
for rec in self:
|
||||
state = 'not_active'
|
||||
if rec.donation_line_ids:
|
||||
for line in rec.donation_line_ids:
|
||||
# permanent sponsorship → active if not in draft/closed/cancel
|
||||
if line.sponsorship_duration == 'permanent' and line.state not in ['draft', 'closed', 'cancel']:
|
||||
state = 'active'
|
||||
break
|
||||
# temporary sponsorship → active if state is active
|
||||
if line.state == 'active':
|
||||
state = 'active'
|
||||
break
|
||||
rec.kafel_state = state
|
||||
|
||||
def view_sponsorship_payment_action(self):
|
||||
"""Enable The Sponsor To Pay Sponsorships Entries"""
|
||||
sponsorship_id = self.env['takaful.sponsorship'].sudo().search([('sponsor_id', '=', self.id), ('has_delay', '=', True)], limit=1)
|
||||
|
|
@ -350,10 +367,10 @@ class ResPartner(models.Model):
|
|||
if self.kafel_id:
|
||||
self.kafel_id.login = vals['mobile']
|
||||
|
||||
if 'mobile' in vals and self.mobile != False:
|
||||
if 'mobile' in vals and self.mobile == False:
|
||||
kafeel = self.env['res.users'].with_user(2).create({
|
||||
'name' : self.name,
|
||||
'branch_custom_id':self.branch_custom_id.id or vals['branch_custom_id'],
|
||||
'branch_custom_id':vals['branch_custom_id'] if 'branch_custom_id' in vals else self.branch_custom_id.id ,
|
||||
'sel_groups_1_9_10' : 9,
|
||||
'partner_id' : self.id,
|
||||
'login' : vals['mobile'],
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ class TakafulSponsorship(models.Model):
|
|||
context['default_sponsor_name'] = rec.sponsor_id.first_name
|
||||
context['default_mobile'] = rec.sponsor_id.mobile
|
||||
context['default_id_num'] = rec.sponsor_id.id_number
|
||||
context['default_payment_ids'] = rec.payment_ids.ids
|
||||
# context['default_payment_ids'] = rec.payment_ids.ids
|
||||
view = self.env.ref('odex_takaful.view_esterdad_wizard_form')
|
||||
return {
|
||||
'name': _('Sponsorship Cancellation'),
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@
|
|||
<field name="name">Responsible Users can access related Sponsorships</field>
|
||||
<field name="model_id" ref="model_takaful_sponsorship"/>
|
||||
<field name="groups" eval="[(4, ref('group_kufula_user'))]"/>
|
||||
<field name="domain_force">[('create_uid','=',user.id)]</field>
|
||||
<field name="domain_force">[('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]</field>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
|
|
@ -226,7 +226,7 @@
|
|||
<field name="name">Users can access related Donations Details Lines</field>
|
||||
<field name="model_id" ref="model_donations_details_lines"/>
|
||||
<field name="groups" eval="[(4, ref('group_kufula_user'))]"/>
|
||||
<field name="domain_force">[(1,'=',1)]</field>
|
||||
<field name="domain_force">[('branch_custom_id.branch', 'child_of', user.employee_id.department_id.id)]</field>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
|
|
|
|||
|
|
@ -348,13 +348,12 @@
|
|||
<field name="debit_payment_attachment_file_name" invisible="1"/>
|
||||
<field name="debit_payment_file_attachment" widget="binary"
|
||||
filename="debit_payment_attachment_file_name"
|
||||
attrs="{'required': [('direct_debit', '=', True)], 'invisible': [('direct_debit', '=', False)]}"
|
||||
optional="hide"/>
|
||||
attrs="{'required': [('direct_debit', '=', True)], 'invisible': [('direct_debit', '=', False)]}"/>
|
||||
<field name="sponsorship_type"
|
||||
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')]}"/>
|
||||
<field name="benefit_id"
|
||||
attrs="{'column_invisible': [('parent.donation_mechanism','!=','with_conditions'),('parent.record_type','!=','sponsorship')]}"/>
|
||||
<field name="payment_month_count" optional="hide"
|
||||
<field name="payment_month_count"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)]}"/>
|
||||
<field name="start_date" string="From" optional="hide" widget="date"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)],'readonly': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]} "/>
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@
|
|||
<field name="user_id" invisible="1" options="{'no_create': True, 'no_create_edit':True}"
|
||||
readonly="1"/>
|
||||
<field name="kafel_state" invisible="0"/>
|
||||
<field name="donation_line_ids" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
|
|
|||
Loading…
Reference in New Issue