FIX view benefit in same record
This commit is contained in:
parent
cc3d6be817
commit
2d7e393978
|
|
@ -216,6 +216,12 @@ class DonationsDetailsLines(models.Model):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
rec.total_months_amount = rec.donation_amount * rec.payment_month_count
|
rec.total_months_amount = rec.donation_amount * rec.payment_month_count
|
||||||
|
|
||||||
|
@api.onchange('sponsorship_duration')
|
||||||
|
def _onchange_sponsorship_duration(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.sponsorship_duration == "permanent":
|
||||||
|
rec.direct_debit = False
|
||||||
|
|
||||||
@api.onchange('product_template_id')
|
@api.onchange('product_template_id')
|
||||||
def _onchange_product_template_id(self):
|
def _onchange_product_template_id(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|
@ -479,6 +485,7 @@ class DonationsDetailsLines(models.Model):
|
||||||
self._onchange_sponsorship_type()
|
self._onchange_sponsorship_type()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('donation_types', 'donation_type')
|
@api.onchange('donation_types', 'donation_type')
|
||||||
def _onchange_sponsorship_type(self):
|
def _onchange_sponsorship_type(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|
@ -632,6 +639,16 @@ class DonationsDetailsLines(models.Model):
|
||||||
domain = expression.AND([domain, [
|
domain = expression.AND([domain, [
|
||||||
('age', '>=', benefit_age_limit)
|
('age', '>=', benefit_age_limit)
|
||||||
]])
|
]])
|
||||||
|
if rec.sponsorship_id or rec.sponsorship_mechanism_id:
|
||||||
|
all_benefit_ids = (
|
||||||
|
|
||||||
|
(
|
||||||
|
rec.sponsorship_mechanism_id.donations_details_lines_mechanism_ids if rec.sponsorship_mechanism_id else
|
||||||
|
self.env['donations.details.lines'])
|
||||||
|
)
|
||||||
|
selected_benefit_ids = all_benefit_ids.mapped('benefit_ids').ids
|
||||||
|
domain = expression.AND([domain, [('id', 'not in', selected_benefit_ids)]])
|
||||||
|
|
||||||
elif rec.record_type == 'donation' and rec.donation_mechanism == "with_conditions" and rec.family_id:
|
elif rec.record_type == 'donation' and rec.donation_mechanism == "with_conditions" and rec.family_id:
|
||||||
domain = [("benefit_id", "=", rec.family_id.id)]
|
domain = [("benefit_id", "=", rec.family_id.id)]
|
||||||
members = self.env['family.member'].sudo().search(domain)
|
members = self.env['family.member'].sudo().search(domain)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
j_type = ""
|
j_type = ""
|
||||||
if payment_method == "cash":
|
if payment_method == "cash":
|
||||||
j_type = "cash"
|
j_type = "cash"
|
||||||
elif payment_method in ("bank", "check"):
|
elif payment_method in ("bank", "check","network"):
|
||||||
j_type = "bank"
|
j_type = "bank"
|
||||||
if j_type:
|
if j_type:
|
||||||
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue