FIX replacement state for benefit
This commit is contained in:
parent
f15176f7c0
commit
3703d1f29d
|
|
@ -1408,6 +1408,7 @@ msgid "Confirm Replacement"
|
|||
msgstr "تأكيد الإستبدال"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__confirmed
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_states__name__confirmed
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__confirmed
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
|
||||
|
|
@ -4357,7 +4358,6 @@ msgid "Overdue in Sponsorships Payment of Total %s"
|
|||
msgstr "متأخر في سداد الكفالة بنسبة إجمالية %s"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__paid
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__month_payment__state__paid
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_payment__state__paid
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__sponsorship_scheduling_line__status__paid
|
||||
|
|
@ -6423,7 +6423,7 @@ msgstr "تاريخ النهاية"
|
|||
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__draft
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donations_details_lines_view_search
|
||||
msgid "To Pay"
|
||||
msgstr "للدفع"
|
||||
msgstr "مسودة"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields,field_description:odex_takaful.field_month_payment__amount
|
||||
|
|
@ -7499,5 +7499,9 @@ msgstr "تم الإستبدال بواسطة"
|
|||
msgid "Replacement Log"
|
||||
msgstr "سجل الإستبدال"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model:ir.model.fields.selection,name:odex_takaful.selection__donations_details_lines__state__paid
|
||||
msgid "Paid"
|
||||
msgstr "منتهي"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -115,8 +115,6 @@ class DonationsDetailsLines(models.Model):
|
|||
def _compute_replacement_count(self):
|
||||
for rec in self:
|
||||
rec.replacement_count = len(rec.replacement_log_ids)
|
||||
# if self.benefit_status == 'non_benefit':
|
||||
# self.state = 'replace'
|
||||
|
||||
@api.depends('sponsorship_id', 'sponsorship_mechanism_id')
|
||||
def _compute_sponsor_id(self):
|
||||
|
|
@ -218,12 +216,6 @@ class DonationsDetailsLines(models.Model):
|
|||
for rec in self:
|
||||
rec.total_months_amount = rec.donation_amount * rec.payment_month_count
|
||||
|
||||
@api.onchange('benefit_id','benefit_ids')
|
||||
def _onchange_benefit_id(self):
|
||||
for rec in self:
|
||||
if rec.benefit_id:
|
||||
if rec.benefit_status and rec.benefit_status == 'non_benefit' and rec.sponsorship_id.record_type == 'sponsorship':
|
||||
rec.state = 'replace'
|
||||
@api.onchange('product_template_id')
|
||||
def _onchange_product_template_id(self):
|
||||
for rec in self:
|
||||
|
|
@ -845,9 +837,7 @@ class DonationsDetailsLines(models.Model):
|
|||
message = _("Benefit IDs changed in a donation item:<br/>%s") % "<br/>".join(changes)
|
||||
sponsorship.message_post(body=message)
|
||||
self.onset_benefit_id()
|
||||
if self.benefit_id:
|
||||
if self.benefit_status and self.benefit_status == 'non_benefit' and self.sponsorship_id.record_type == 'sponsorship':
|
||||
self.state = 'replace'
|
||||
|
||||
return res
|
||||
|
||||
def action_view_replacement_wizard(self):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,26 @@ from dateutil.relativedelta import relativedelta
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
class GrantBenefit(models.Model):
|
||||
_inherit = 'grant.benefit'
|
||||
|
||||
def action_second_accepted(self):
|
||||
super(GrantBenefit, self).action_second_accepted()
|
||||
for member in self.member_ids:
|
||||
sponsorships_main = self.env['donations.details.lines'].search([
|
||||
('benefit_id', '=', member.id,),('state', '=', 'active')
|
||||
])
|
||||
sponsorships_multi = self.env['donations.details.lines'].search([
|
||||
('benefit_ids', 'in', member.id),('state', '=', 'active')
|
||||
])
|
||||
sponsorships = sponsorships_main | sponsorships_multi
|
||||
if sponsorships:
|
||||
for sponsorship in sponsorships:
|
||||
if member.member_status and member.member_status == 'non_benefit' and sponsorship.record_type == 'sponsorship':
|
||||
sponsorship.sudo().write({'state': 'replace'})
|
||||
|
||||
|
||||
|
||||
class FamilyMember(models.Model):
|
||||
_inherit = 'family.member'
|
||||
|
||||
|
|
@ -69,20 +89,20 @@ class FamilyMember(models.Model):
|
|||
self.is_restricted = True
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def write(self, vals):
|
||||
res = super(FamilyMember, self).write(vals)
|
||||
if 'member_status' in vals:
|
||||
for member in self:
|
||||
sponsorships_main = self.env['donations.details.lines'].search([
|
||||
('benefit_id', '=', member.id)
|
||||
])
|
||||
sponsorships_multi = self.env['donations.details.lines'].search([
|
||||
('benefit_ids', 'in', member.id)
|
||||
])
|
||||
sponsorships = sponsorships_main | sponsorships_multi
|
||||
|
||||
if sponsorships:
|
||||
if member.member_status and member.member_status == 'non_benefit' and sponsorships.sponsorship_id.record_type == 'sponsorship':
|
||||
sponsorships.write({'state': 'replace'})
|
||||
return res
|
||||
# @api.model
|
||||
# def write(self, vals):
|
||||
# res = super(FamilyMember, self).write(vals)
|
||||
# if 'member_status' in vals:
|
||||
# for member in self:
|
||||
# sponsorships_main = self.env['donations.details.lines'].search([
|
||||
# ('benefit_id', '=', member.id)
|
||||
# ])
|
||||
# sponsorships_multi = self.env['donations.details.lines'].search([
|
||||
# ('benefit_ids', 'in', member.id)
|
||||
# ])
|
||||
# sponsorships = sponsorships_main | sponsorships_multi
|
||||
#
|
||||
# if sponsorships:
|
||||
# if member.member_status and member.member_status == 'non_benefit' and sponsorships.sponsorship_id.record_type == 'sponsorship':
|
||||
# sponsorships.write({'state': 'replace'})
|
||||
# return res
|
||||
|
|
|
|||
|
|
@ -538,13 +538,13 @@
|
|||
invisible="1"/>
|
||||
<field name="sponsor_id" invisible="1"/>
|
||||
<field name="direct_debit_partner_bank_id" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': sponsor_id}"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
attrs="{'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
<field name="journal_id"
|
||||
attrs="{'invisible': [('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
attrs="{'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)], 'required': [('direct_debit', '=', True)]}"/>
|
||||
|
||||
<field name="debit_payment_file_attachment" widget="binary"
|
||||
filename="debit_payment_attachment_file_name"
|
||||
attrs="{'required': [('direct_debit', '=', True)], 'invisible': [('direct_debit', '=', False)]}"/>
|
||||
attrs="{'required': [('direct_debit', '=', True)], 'invisible': ['|', ('payment_month_count_visibility','!=', True),('direct_debit', '=', False)]}"/>
|
||||
<field name="debit_payment_attachment_file_name" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
|
|
|
|||
|
|
@ -34,17 +34,6 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
check_number = fields.Char(string='Check Number')
|
||||
check_due_date = fields.Date(string='Check Due Date')
|
||||
sponsorship_payment = fields.Boolean(string='Sponsorship Payment', default=False)
|
||||
parent_id = fields.Many2one(
|
||||
'account.payment.register',
|
||||
string='Parent Register',
|
||||
ondelete='cascade'
|
||||
)
|
||||
|
||||
account_payment_register_ids = fields.One2many(
|
||||
'account.payment.register',
|
||||
'parent_id',
|
||||
string='Sub Payments'
|
||||
)
|
||||
|
||||
@api.onchange("takaful_payment_method_id")
|
||||
def onchange_takaful_payment_method_id(self):
|
||||
|
|
@ -53,9 +42,9 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
rec.journal_id = rec.takaful_payment_method_id.journal_id.id
|
||||
payment_method = rec.takaful_payment_method_id.payment_method
|
||||
j_type = ""
|
||||
if payment_method in ["cash", "check"]:
|
||||
if payment_method == "cash":
|
||||
j_type = "cash"
|
||||
elif payment_method == "bank":
|
||||
elif payment_method in ("bank", "check"):
|
||||
j_type = "bank"
|
||||
if j_type:
|
||||
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<field name="is_refund_sponsorship" invisible="1"/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='amount']" position="attributes">-->
|
||||
<!-- <attribute name="readonly">context.get('sponsorship_line_ids')</attribute>-->
|
||||
<!-- <attribute name="attrs">{'readonly':[('group_payment','=',True)]}</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
<xpath expr="//field[@name='journal_id']" position="attributes">
|
||||
<attribute name="attrs">{'readonly':[('is_refund_sponsorship','=',True)]}</attribute>
|
||||
|
|
@ -51,14 +51,78 @@
|
|||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
||||
<field name="transaction_attachment_file_name" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='group_payment']" position="after">
|
||||
<field name="account_payment_register_ids" attrs="{'invisible': [('group_payment', '=', False)]}">
|
||||
<tree editable="True">
|
||||
<field name="sponsorship_payment" invisible="1"/>
|
||||
<field name="takaful_payment_method_id" attrs="{'invisible': [('sponsorship_payment', '=', False)]}" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</xpath>
|
||||
<!--<xpath expr="//group" position="after">-->
|
||||
<!-- <notebook>-->
|
||||
<!-- <page string="Sub Payments" attrs="{'invisible': [('group_payment', '=', False)]}">-->
|
||||
<!-- <field name="account_payment_register_ids" attrs="{'invisible': [('group_payment', '=', False)]}" nolabel="1">-->
|
||||
<!-- <tree editable="bottom" delete="true" create="true">-->
|
||||
<!-- <field name="sponsorship_payment" invisible="1"/>-->
|
||||
<!-- <field name="takaful_payment_method" invisible="1"/>-->
|
||||
<!-- <field name="available_partner_bank_ids" invisible="1"/>-->
|
||||
<!-- <field name="company_id" invisible="1"/>-->
|
||||
<!-- <field name="takaful_payment_method_id" options="{'no_create': True, 'no_create_edit': True}"/>-->
|
||||
<!-- <field name="journal_id" string="Association Journal"/>-->
|
||||
<!-- <field name="amount"/>-->
|
||||
<!-- <field name="check_number"-->
|
||||
<!-- attrs="{-->
|
||||
<!-- 'invisible': [-->
|
||||
<!-- ('takaful_payment_method','!=','check')-->
|
||||
<!-- ],-->
|
||||
<!-- 'required': [-->
|
||||
<!-- ('takaful_payment_method','=','check')-->
|
||||
<!-- ]-->
|
||||
<!-- }"-->
|
||||
<!-- optional="hide"/>-->
|
||||
<!-- <field name="check_due_date"-->
|
||||
<!-- attrs="{-->
|
||||
<!-- 'invisible': [-->
|
||||
<!-- ('takaful_payment_method','!=','check')-->
|
||||
<!-- ],-->
|
||||
<!-- 'required': [-->
|
||||
<!-- ('takaful_payment_method','=','check')-->
|
||||
<!-- ]-->
|
||||
<!-- }"-->
|
||||
<!-- optional="hide"/>-->
|
||||
<!-- <field name="partner_bank_id"-->
|
||||
<!-- context="{-->
|
||||
<!-- 'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create',-->
|
||||
<!-- 'default_partner_id': context.get('force_sponsorship_line_partner_id')-->
|
||||
<!-- }"-->
|
||||
<!-- attrs="{-->
|
||||
<!-- 'required': [-->
|
||||
<!-- ('takaful_payment_method','=','bank')-->
|
||||
<!-- ],-->
|
||||
<!-- 'invisible': [-->
|
||||
<!-- ('takaful_payment_method','!=','bank')-->
|
||||
<!-- ]-->
|
||||
<!-- }"-->
|
||||
<!-- readonly="0"-->
|
||||
<!-- optional="hide"/>-->
|
||||
<!-- <field name="transaction_file_attachment"-->
|
||||
<!-- widget="binary"-->
|
||||
<!-- filename="transaction_attachment_file_name"-->
|
||||
<!-- attrs="{-->
|
||||
<!-- 'invisible': [-->
|
||||
<!-- ('takaful_payment_method','not in',['bank', 'check'])-->
|
||||
<!-- ],-->
|
||||
<!-- 'required': ['|',-->
|
||||
<!-- ('takaful_payment_method','=','bank'),-->
|
||||
<!-- ('takaful_payment_method','=','check')-->
|
||||
<!-- ]-->
|
||||
<!-- }"-->
|
||||
<!-- optional="hide"/>-->
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- </notebook>-->
|
||||
<!-- </xpath>-->
|
||||
<!-- <xpath expr="//footer/button[@name='action_create_payments']" position="after">-->
|
||||
<!-- <button name="action_register_all_lines"-->
|
||||
<!-- type="object"-->
|
||||
<!-- string="Register All Lines"-->
|
||||
<!-- class="btn-secondary"-->
|
||||
<!-- attrs="{'invisible': [('line_ids','=',False)]}"/>-->
|
||||
<!-- </xpath>-->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue