Merge pull request #5990 from expsa/uyu

[IMP] odex_benefit: IMP benefit
This commit is contained in:
kchyounes19 2026-01-05 14:31:28 +01:00 committed by GitHub
commit 94aa64bd3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 86 additions and 31 deletions

View File

@ -684,6 +684,21 @@ class GrantBenefitProfile(models.Model):
family.current_rent_contract_id = active_contracts[:1] or False
@api.depends('member_ids', 'member_ids.member_status', 'add_replacement_mother',
'replacement_mother_family_member_id', 'replacement_mother_status', 'mother_family_member_id',
'mother_status')
def get_members_count(self):
for ben in self:
if ben.id:
ben.benefit_member_count = len(ben.member_ids.filtered(lambda x: x.member_status == 'benefit'))
if ben.add_replacement_mother and not ben.replacement_mother_family_member_id and ben.replacement_mother_status == 'benefit':
ben.benefit_member_count += 1
if not ben.mother_family_member_id and ben.mother_status == 'benefit':
ben.benefit_member_count += 1
else:
ben.benefit_member_count = 0.0
@api.depends('current_rent_contract_id')
def _compute_rent_from_contract(self):
for family in self:
@ -2259,17 +2274,6 @@ class GrantBenefitProfile(models.Model):
rec.replacement_mother_diseases_attachment_ids.write({'member_id': replacement_member.id})
rec.replacement_mother_disabilities_attachment_ids.write({'member_id': replacement_member.id})
def get_members_count(self):
for ben in self:
if ben.id:
ben.benefit_member_count = len(ben.member_ids.filtered(lambda x: x.member_status == 'benefit'))
if ben.add_replacement_mother and not ben.replacement_mother_family_member_id and ben.replacement_mother_status == 'benefit':
ben.benefit_member_count += 1
if not ben.mother_family_member_id and ben.mother_status == 'benefit':
ben.benefit_member_count += 1
else:
ben.benefit_member_count = 0.0
def get_non_members_count(self):
for ben in self:

View File

@ -823,6 +823,19 @@ class AttachmentsSettings(models.Model):
member_appearance_seq = fields.Integer(string='Appearance Sequence')
income_appearance_seq = fields.Integer(string='Appearance Sequence')
is_mother_salary = fields.Boolean(string="Is Mother Salary", default=False)
parent_id = fields.Many2one('attachments.settings',string='Parent')
child_ids = fields.One2many('attachments.settings','parent_id',string='Children')
@api.constrains('parent_id')
def _check_no_recursive_parent(self):
for rec in self:
parent = rec.parent_id
while parent:
if parent == rec:
raise ValidationError(
"Recursive hierarchy is not allowed."
)
parent = parent.parent_id
class EducationIlliterateReason(models.Model):
_name = 'education.illiterate.reason'

View File

@ -605,7 +605,7 @@ class FamilyMemberProfile(models.Model):
_("Over %s years old and not enrolled in any educational institution.") % male_benefit_age
)
elif current_education_status_id.case_study == 'continuous':
if current_education_status_id.specialization_ids.is_scientific_specialty and rec.age > exceptional_age_scientific_specialty:
if current_education_status_id.specialization_ids.is_scientific_specialty and rec.age >= exceptional_age_scientific_specialty:
rec.member_status = 'non_benefit'
reasons.append(
_("Over %s years old and not enrolled in a scientific or vocational specialization.")

View File

@ -17,8 +17,10 @@ class BenefitAttachment(models.Model):
allow_days = fields.Integer(compute='get_allow_days',string='Allow Days')
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')])
diseases_id = fields.Many2one('attachments.settings', string="Diseases",domain=[('attach_type', '=', 'diseases_attach')])
disabilities_id = fields.Many2one('attachments.settings', string="Disabilities",domain=[('attach_type', '=', 'disabilities_attach')])
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)]")
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)]")
hobby_attach = fields.Binary(attachment=True, string="Hobby Attach")
# fields to management required and delete records in benefit attachment
is_required = fields.Boolean(string='Is Required?')
@ -27,6 +29,7 @@ class BenefitAttachment(models.Model):
replacement_mother_grant_benefit_id = fields.Many2one('grant.benefit', string='Replacement Mother Grant Benefit')
show_in_portal = fields.Boolean(default=False, string="Show In Portal")
supporter_id = fields.Many2one(comodel_name='res.partner',string='Supporter',domain=[('is_supporter', '=', True)],)
support_amount = fields.Float(string='Support Amount')
def action_preview_attachment(self):
# Custom function to open the preview
@ -68,12 +71,12 @@ class BenefitAttachment(models.Model):
@api.onchange('diseases_id')
def onchange_diseases_id(self):
for rec in self:
if rec.diseases_id:
rec.name = rec.diseases_id.name
if not rec.diseases_id:
rec.diseases_child_id = False
@api.onchange('disabilities_id')
def onchange_disabilities_id(self):
for rec in self:
if rec.disabilities_id:
rec.name = rec.disabilities_id.name
if not rec.disabilities_id:
rec.disabilities_child_id = False

View File

@ -356,6 +356,7 @@
<field name="name">Attachments Settings</field>
<field name="res_model">attachments.settings</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('parent_id', '=', False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the Attachment Setting
</p>

View File

@ -1087,6 +1087,7 @@
<group>
<group>
<field name="name"/>
<field name="parent_id" invisible="1" domain="[('attach_type','=',attach_type), ('id','!=',id)]"/>
<field name="attach_type"/>
<field name="family_appearance_seq"
attrs="{'invisible':[('attach_type','!=','family_attach')]}"/>
@ -1098,11 +1099,27 @@
<!-- <field name="diseases_id"/>-->
<!-- <field name="disabilities_id"/>-->
<field name="is_mother_salary" attrs="{'invisible':[('attach_type','!=','income_attach')]}"/>
</group>
<group>
<field name="is_required"/>
<field name="is_default"/>
<field name="show_in_portal"/>
</group>
</group>
<notebook attrs="{'invisible':[('attach_type','not in',['diseases_attach','disabilities_attach'])]}">
<page string="Children" >
<field name="child_ids" context="{'default_attach_type': attach_type}">
<tree editable="bottom">
<field name="name"/>
<field name="attach_type" invisible="1"/>
<field name="is_required"/>
<field name="is_default"/>
<field name="show_in_portal"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>

View File

@ -512,7 +512,8 @@
<field string="Documents" name="doc_count" widget="statinfo"/>
</button>
<button name="action_view_benefit_members" type="object" icon="fa-users">
<field string="Benefit Members" name="benefit_member_count" widget="statinfo"/>
<field string="Benefit Members" name="benefit_member_count" force_save="1"
widget="statinfo"/>
</button>
<button name="action_view_non_benefit_members" type="object" icon="fa-users">
@ -862,7 +863,8 @@
<field name="mother_diseases_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="diseases_id" required="1"/>
<field name="name"/>
<field name="diseases_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment" type="object"
@ -870,6 +872,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="mother_grant_benefit_id" invisible="1"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
@ -880,7 +883,8 @@
<field name="mother_disabilities_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="disabilities_id" required="1"/>
<field name="name"/>
<field name="disabilities_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment"
@ -888,6 +892,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="mother_grant_benefit_id" invisible="1"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
@ -1124,7 +1129,8 @@
<field name="replacement_mother_diseases_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="diseases_id" required="1"/>
<field name="name"/>
<field name="diseases_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment" type="object"
@ -1132,6 +1138,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="replacement_mother_grant_benefit_id" invisible="1"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
@ -1143,7 +1150,8 @@
widget="one2many_list">
<tree editable="bottom">
<field name="disabilities_id" required="1"/>
<field name="name"/>
<field name="disabilities_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment"
@ -1151,6 +1159,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="replacement_mother_grant_benefit_id" invisible="1"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
@ -1304,7 +1313,8 @@
<field name="diseases_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="diseases_id" required="1"/>
<field name="name"/>
<field name="diseases_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment"
@ -1312,6 +1322,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
</tree>
@ -1321,7 +1332,8 @@
<field name="disabilities_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="disabilities_id" required="1"/>
<field name="name"/>
<field name="disabilities_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" widget="binary" string="File content"
filename="attachment_file_name"/>
<button name="action_preview_attachment"
@ -1329,6 +1341,7 @@
attrs="{'invisible': [('file_size', '=', 0)]}"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="member_id" invisible="1"/>
<field name="file_size" invisible="1"/>
</tree>
@ -1667,11 +1680,11 @@
<label for="estimated_rent_amount"
attrs="{'invisible':[('property_type_code','!=','rent')]}"/>
<field name="estimated_rent_amount" nolabel="1" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"
options="{'currency_field': 'currency_id'}" force_save="1"
attrs="{'invisible':[('property_type_code','!=','rent')]}"/>
<field name="member_income" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
<field name="benefit_category_id" readonly="1" force_save="1"/>
options="{'currency_field': 'currency_id'}" force_save="1"/>
<field name="benefit_category_id" force_save="1"/>
</group>
</page>
<!-- <page string="Craft Skills" attrs="{'invisible': [('is_craft', '=', False)]}">-->

View File

@ -222,11 +222,13 @@
<page string="Diseases">
<field name="diseases_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="name"/>
<field name="diseases_id" required="1"/>
<field name="diseases_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" string="File content"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="member_id" invisible="1"/>
</tree>
</field>
@ -234,11 +236,13 @@
<page string="Disabilities">
<field name="disabilities_attachment_ids" widget="one2many_list">
<tree editable="bottom">
<field name="name"/>
<field name="disabilities_id" required="1"/>
<field name="disabilities_child_id" required="1"/>
<field name="name" string="Description"/>
<field name="datas" string="File content"/>
<field name="start_date"/>
<field name="supporter_id"/>
<field name="support_amount"/>
<field name="member_id" invisible="1"/>
</tree>
</field>

View File

@ -99,7 +99,7 @@
<group>
<group>
<field name="account_id"
attrs="{'invisible':[('service_type', 'in', ['electrical_devices', 'transportation_insurance'])]}"/>
attrs="{'invisible':[('service_type', 'in', ['electrical_devices'])]}"/>
<field name="payment_method"/>
</group>
<group>