commit
31ad5cca09
|
|
@ -39,7 +39,7 @@ class DonationsDetailsLines(models.Model):
|
|||
donation_qty = fields.Float(string='Donation QTY', default=1)
|
||||
donation_mechanism = fields.Selection(
|
||||
[('with_conditions', _('With Conditions')), ('without_conditions', _('Without Conditions'))],
|
||||
string='Donation Mechanism', readonly=True)
|
||||
string='Donation Mechanism', compute='_compute_donation_mechanism', store=True, readonly=True)
|
||||
benefit_type = fields.Selection([('orphan', 'Orphans'), ('widow', 'Widows'), ('both', 'Both')],
|
||||
string='Sponsorship Beneficiary Type', tracking=True, default="both")
|
||||
sponsorship_type = fields.Selection([('person', 'Individual'), ('group', 'Group')], string='Sponsorship Type',
|
||||
|
|
@ -72,7 +72,7 @@ class DonationsDetailsLines(models.Model):
|
|||
sponsorships_computed = fields.Boolean(copy=False, readonly=True)
|
||||
direct_debit = fields.Boolean(string='Direct Debit')
|
||||
benefit_id_number = fields.Char("Benefit ID Number")
|
||||
benefit_family_code = fields.Char("Benefit Family Code")
|
||||
benefit_family_code = fields.Char("Benefit Family Code", compute='_compute_family_code', store=True, readonly=True)
|
||||
editable = fields.Boolean(string="Editable", default=True) # To differentiate
|
||||
direct_debit_partner_bank_id = fields.Many2one("res.partner.bank", string="Direct Debit Partner Bank", domain="[('partner_id', '=', sponsor_id)]")
|
||||
sponsor_id = fields.Many2one('res.partner', compute='_compute_sponsor_id', store=True, readonly=True)
|
||||
|
|
@ -288,7 +288,7 @@ class DonationsDetailsLines(models.Model):
|
|||
rec.end_date and
|
||||
rec.end_date >= today and
|
||||
rec.state == 'active'
|
||||
and rec.sponsorship_id.state in ['canceled' , 'closed']
|
||||
and rec.sponsorship_id.state not in ['canceled' , 'closed']
|
||||
)
|
||||
rec.show_extend_button = show_extend_button
|
||||
|
||||
|
|
@ -701,7 +701,7 @@ class DonationsDetailsLines(models.Model):
|
|||
rec.total_donation_amount = rec.total_months_amount * (rec.benefits_count or 1)
|
||||
|
||||
@api.depends('record_type', 'benefit_id')
|
||||
def _compute_family_id(self):
|
||||
def _compute_family_code(self):
|
||||
for rec in self:
|
||||
if rec.family_id:
|
||||
rec.benefit_family_code = rec.family_id.code
|
||||
|
|
@ -712,8 +712,8 @@ class DonationsDetailsLines(models.Model):
|
|||
if rec.benefit_id and rec.benefit_id.benefit_id:
|
||||
family = rec.benefit_id.benefit_id
|
||||
|
||||
rec.family_id = family or False
|
||||
rec.benefit_family_code = family.code if family else False
|
||||
rec.family_id = family or False
|
||||
rec.benefit_family_code = family.code if family else False
|
||||
|
||||
@api.depends('family_id','record_type')
|
||||
def _compute_family_domain_ids(self):
|
||||
|
|
@ -876,13 +876,21 @@ class DonationsDetailsLines(models.Model):
|
|||
'product_template_id': domain}
|
||||
}
|
||||
|
||||
|
||||
@api.onchange('donation_type')
|
||||
def onchange_donation_type(self):
|
||||
@api.depends('donation_type', 'sponsorship_mechanism_id', 'sponsorship_id')
|
||||
def _compute_donation_mechanism(self):
|
||||
for rec in self:
|
||||
if rec.donation_type == 'sponsorship':
|
||||
rec.donation_mechanism = 'with_conditions'
|
||||
|
||||
elif rec.donation_type == 'donation':
|
||||
if rec.sponsorship_mechanism_id:
|
||||
rec.donation_mechanism = 'with_conditions'
|
||||
elif rec.sponsorship_id:
|
||||
rec.donation_mechanism = 'without_conditions'
|
||||
|
||||
else:
|
||||
rec.donation_mechanism = False
|
||||
|
||||
def compute_sponsorships_lines(self):
|
||||
for rec in self:
|
||||
rec.write({'sponsorship_scheduling_line_ids': [(5, 0, 0)]})
|
||||
|
|
|
|||
|
|
@ -950,7 +950,7 @@ class TakafulSponsorship(models.Model):
|
|||
Clears the One2many field when record_type is changed and data exists in the other field.
|
||||
"""
|
||||
if self.record_type == 'sponsorship':
|
||||
self.donation_mechanism = False
|
||||
self.donation_mechanism = 'with_conditions'
|
||||
elif self.record_type == 'donation':
|
||||
self.donation_mechanism = 'without_conditions'
|
||||
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@
|
|||
<button name="action_set_close" type="object"
|
||||
string="Close" class="oe_highlight"
|
||||
attrs="{'invisible': [('state', 'not in', ['wait_pay', 'paid'])]}"/>
|
||||
<button name="action_refund" type="object"
|
||||
string="Refund All" class="oe_highlight"
|
||||
attrs="{'invisible': ['|','|',('state','not in',['paid','partial_refund','under_replacement','replacement_done']),('record_type','!=','donation'), ('cancel_refund', '=', True)]}"/>
|
||||
<!-- <button name="action_refund" type="object"-->
|
||||
<!-- string="Refund All" class="oe_highlight"-->
|
||||
<!-- attrs="{'invisible': ['|','|',('state','not in',['paid','partial_refund','under_replacement','replacement_done']),('record_type','!=','donation'), ('cancel_refund', '=', True)]}"/>-->
|
||||
<button name="action_set_esterdad" type="object"
|
||||
string="طلب الاسترداد" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('state','not in',['paid','partial_refund','under_replacement','replacement_done']), ('cancel_refund', '=', True)]}"/>
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
state = 'paid'
|
||||
elif line.record_type == 'donation':
|
||||
if line.donation_mechanism == 'with_conditions':
|
||||
state = 'active'
|
||||
state = 'paid'
|
||||
else:
|
||||
state = 'paid'
|
||||
line.write({'state': state})
|
||||
|
|
|
|||
Loading…
Reference in New Issue