Merge pull request #6244 from expsa/ytoo

Ytoo
This commit is contained in:
kchyounes19 2026-01-19 15:46:51 +01:00 committed by GitHub
commit 4235c4101c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 72 additions and 42 deletions

View File

@ -18510,3 +18510,34 @@ msgstr "تجاوزت عمر %s وليس لديها اخوة قصر"
#, python-format #, python-format
msgid "She is over %s years of age." msgid "She is over %s years of age."
msgstr "تجاوزت عمر %s" msgstr "تجاوزت عمر %s"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_location_settings__replacement_mother_is_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_marital_status__replacement_mother_is_benefit
msgid "Replacement Mother Is Benefit?"
msgstr "هل الأم البديلة مستفيدة؟"
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#, python-format
msgid "Family is suspended or refused."
msgstr "توقفت الأسرة أو تم رفضها."
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#, python-format
msgid "Replacement mother marital or location information is missing."
msgstr "معلومات الحالة الاجتماعية أو موقع السكن للأم البديلة مفقودة."
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#, python-format
msgid "The replacement mother's marital status is not eligible for benefits."
msgstr "الحالة الاجتماعية للأم البديلة غير مؤهلة للاستفادة."
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#, python-format
msgid "The replacement mother's location is not eligible for benefits."
msgstr "مكان سكن الأم البديلة غير مؤهل للاستفادة."

View File

@ -750,10 +750,6 @@ class GrantBenefitProfile(models.Model):
@api.depends('is_mother_work','mother_salary_ids','mother_expenses_ids','mother_debits_ids') @api.depends('is_mother_work','mother_salary_ids','mother_expenses_ids','mother_debits_ids')
def _compute_mother_net_income(self): def _compute_mother_net_income(self):
for rec in self: for rec in self:
if not rec.is_mother_work:
rec.mother_net_income = 0.0
continue
deductions = ( deductions = (
sum(rec.mother_expenses_ids.filtered('deduct_from_family_income').mapped('amount')) + sum(rec.mother_expenses_ids.filtered('deduct_from_family_income').mapped('amount')) +
sum(rec.mother_debits_ids.filtered('deduct_from_family_income').mapped('monthly_installment')) sum(rec.mother_debits_ids.filtered('deduct_from_family_income').mapped('monthly_installment'))
@ -1424,30 +1420,28 @@ class GrantBenefitProfile(models.Model):
return status, reasons return status, reasons
def check_replacement_mother_status(self): def check_replacement_mother_status(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
mini_income_for_mother = validation_setting.mini_income_for_mother
max_income_for_mother = validation_setting.max_income_for_mother
for rec in self: for rec in self:
reasons = [] reasons = []
status = 'benefit' status = 'benefit'
if not rec.add_replacement_mother: if not rec.add_replacement_mother:
continue continue
if not rec.replacement_mother_location_conf.is_benefit or not rec.replacement_mother_marital_conf.is_benefit or rec.state in ['suspended_second_approve','refused']: if rec.state in ['suspended_second_approve', 'refused']:
status = 'non_benefit' status = 'non_benefit'
reasons.append(_("The replacement mother's marital or location conditions are not eligible.")) reasons.append(_("Family is suspended or refused."))
elif rec.replacement_mother_marital_conf.is_benefit: return status, reasons
if rec.replacement_is_mother_work and rec.replacement_mother_country_id.code == 'SA' or (
rec.replacement_mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'): if not rec.replacement_mother_marital_conf or not rec.replacement_mother_location_conf:
if mini_income_for_mother < rec.replacement_mother_income <= max_income_for_mother:
status = 'non_benefit' status = 'non_benefit'
reasons.append(_("The replacement mother's income is between minimum and maximum thresholds.")) reasons.append(_("Replacement mother marital or location information is missing."))
elif rec.replacement_mother_income <= mini_income_for_mother: return status, reasons
status = 'benefit'
elif rec.replacement_mother_income > max_income_for_mother: if not rec.replacement_mother_marital_conf.replacement_mother_is_benefit:
status = 'benefit' status = 'non_benefit'
elif not rec.replacement_is_mother_work and rec.replacement_mother_country_id.code == 'SA' or ( reasons.append(_("The replacement mother's marital status is not eligible for benefits."))
rec.replacement_mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'):
status = 'benefit' if not rec.replacement_mother_location_conf.replacement_mother_is_benefit:
status = 'non_benefit'
reasons.append(_("The replacement mother's location is not eligible for benefits."))
return status, reasons return status, reasons
def delete_from_db(self): def delete_from_db(self):
@ -2212,18 +2206,11 @@ class GrantBenefitProfile(models.Model):
for rec in self: for rec in self:
total = 0.0 total = 0.0
rec.total_income = 0.0 rec.total_income = 0.0
if not rec.add_replacement_mother:
if rec.mother_status == 'non_benefit': if rec.mother_status == 'non_benefit':
total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount'))
elif rec.mother_status == 'benefit': elif rec.mother_status == 'benefit':
total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.mother_income total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.mother_income
rec.total_income = total rec.total_income = total
if rec.add_replacement_mother:
if rec.replacement_mother_status == 'non_benefit':
total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount'))
elif rec.replacement_mother_status == 'benefit':
total = sum(rec.salary_ids.filtered(lambda e: e.approved).mapped('salary_amount')) + rec.replacement_mother_income
rec.total_income += total
def get_mother_name(self): def get_mother_name(self):
for rec in self: for rec in self:
@ -2655,7 +2642,7 @@ class GrantBenefitProfile(models.Model):
'message': _('Not Benefit')} 'message': _('Not Benefit')}
return res return res
@api.onchange('replacement_mother_marital_conf', 'replacement_mother_location_conf', 'replacement_mother_income') @api.onchange('replacement_mother_marital_conf', 'replacement_mother_location_conf')
def _onchange_replacement_mother_info(self): def _onchange_replacement_mother_info(self):
res = {} res = {}
for rec in self: for rec in self:

View File

@ -806,6 +806,7 @@ class LocationSettings(models.Model):
location_type = fields.Selection([('member', _('Member')), ('mother_location', _('Mother Location'))]) location_type = fields.Selection([('member', _('Member')), ('mother_location', _('Mother Location'))])
is_benefit = fields.Boolean(string='Is Benefit?') is_benefit = fields.Boolean(string='Is Benefit?')
is_far_from_family = fields.Boolean(string='Is Far From Family?') is_far_from_family = fields.Boolean(string='Is Far From Family?')
replacement_mother_is_benefit = fields.Boolean(string="Replacement Mother Is Benefit?", default=True, )
class AttachmentsSettings(models.Model): class AttachmentsSettings(models.Model):
_name = 'attachments.settings' _name = 'attachments.settings'
@ -897,6 +898,7 @@ class MaritalStatus(models.Model):
name = fields.Char(string="Name") name = fields.Char(string="Name")
is_benefit = fields.Boolean(string='Is Benefit?') is_benefit = fields.Boolean(string='Is Benefit?')
is_dead = fields.Boolean(string='Is Dead?') is_dead = fields.Boolean(string='Is Dead?')
replacement_mother_is_benefit = fields.Boolean(string="Replacement Mother Is Benefit?",default=True,)
class AgeCategory(models.Model): class AgeCategory(models.Model):
_name = 'age.category' _name = 'age.category'

View File

@ -18,7 +18,7 @@ class BenefitAttachment(models.Model):
attach_id = fields.Many2one('attachments.settings', string="Attach",domain=[('attach_type', '=', 'member_attach')]) attach_id = fields.Many2one('attachments.settings', string="Attach",domain=[('attach_type', '=', 'member_attach')])
hobbies_id = fields.Many2one('attachments.settings', string="Hobby",domain=[('attach_type', '=', 'hobbies_attach')]) hobbies_id = fields.Many2one('attachments.settings', string="Hobby",domain=[('attach_type', '=', 'hobbies_attach')])
diseases_id = fields.Many2one('attachments.settings', string="Diseases",domain=[('attach_type', '=', 'diseases_attach'), ('parent_id','=',False)]) diseases_id = fields.Many2one('attachments.settings', string="Diseases",domain=[('attach_type', '=', 'diseases_attach'), ('parent_id','=',False)])
diseases_child_id = fields.Many2one('attachments.settings',string="Sub Disease",domain="[('parent_id','=',diseases_id)]") diseases_child_id = fields.Many2one('attachments.settings',string="Sub Disease",domain="[('attach_type', '=', 'diseases_attach'),('parent_id','=',diseases_id)]")
disabilities_id = fields.Many2one('attachments.settings', string="Disabilities",domain=[('attach_type', '=', 'disabilities_attach'), ('parent_id','=',False)]) disabilities_id = fields.Many2one('attachments.settings', string="Disabilities",domain=[('attach_type', '=', 'disabilities_attach'), ('parent_id','=',False)])
disabilities_child_id = fields.Many2one('attachments.settings',string="Sub Disability",domain="[('parent_id','=',disabilities_id)]") disabilities_child_id = fields.Many2one('attachments.settings',string="Sub Disability",domain="[('parent_id','=',disabilities_id)]")
hobby_attach = fields.Binary(attachment=True, string="Hobby Attach") hobby_attach = fields.Binary(attachment=True, string="Hobby Attach")

View File

@ -1016,9 +1016,13 @@
<group> <group>
<field name="name"/> <field name="name"/>
<field name="location_type"/> <field name="location_type"/>
<field name="is_benefit"/>
<field name="is_far_from_family"/> <field name="is_far_from_family"/>
</group> </group>
<group>
<field name="is_benefit"/>
<field name="replacement_mother_is_benefit"/>
</group>
</group> </group>
</sheet> </sheet>
</form> </form>
@ -1033,6 +1037,7 @@
<field name="location_type"/> <field name="location_type"/>
<field name="is_benefit"/> <field name="is_benefit"/>
<field name="is_far_from_family"/> <field name="is_far_from_family"/>
<field name="replacement_mother_is_benefit"/>
</tree> </tree>
</field> </field>
</record> </record>
@ -1333,9 +1338,13 @@
<group> <group>
<group> <group>
<field name="name"/> <field name="name"/>
<field name="is_benefit"/>
<field name="is_dead"/> <field name="is_dead"/>
</group> </group>
<group>
<field name="is_benefit"/>
<field name="replacement_mother_is_benefit"/>
</group>
</group> </group>
</sheet> </sheet>
</form> </form>
@ -1348,6 +1357,7 @@
<tree> <tree>
<field name="name"/> <field name="name"/>
<field name="is_benefit"/> <field name="is_benefit"/>
<field name="replacement_mother_is_benefit"/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -909,7 +909,7 @@
</tree> </tree>
</field> </field>
</page> </page>
<page string="Mother Expenses" attrs="{'invisible':[('is_mother_work','=',False)]}"> <page string="Mother Expenses">
<field name="mother_expenses_ids" context="{'default_state': 'accepted'}" <field name="mother_expenses_ids" context="{'default_state': 'accepted'}"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"> attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}">
<tree editable="top"> <tree editable="top">
@ -929,7 +929,7 @@
</tree> </tree>
</field> </field>
</page> </page>
<page string="Mother Income" attrs="{'invisible':[('is_mother_work','=',False)]}"> <page string="Mother Income">
<field name="mother_salary_ids" <field name="mother_salary_ids"
context="{'default_state': 'accepted','default_is_mother_salary': True}" context="{'default_state': 'accepted','default_is_mother_salary': True}"
mode="tree" mode="tree"
@ -955,7 +955,7 @@
</tree> </tree>
</field> </field>
</page> </page>
<page string="Mother Debts" attrs="{'invisible':[('is_mother_work','=',False)]}"> <page string="Mother Debts">
<field name="mother_debits_ids" context="{'default_state': 'accepted'}" <field name="mother_debits_ids" context="{'default_state': 'accepted'}"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"> attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}">
<form> <form>