Merge pull request #5712 from expsa/nn

[IMP] odex_benefit: IMP benefit
This commit is contained in:
kchyounes19 2025-12-11 15:44:29 +01:00 committed by GitHub
commit 195bd8ffe4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 3 deletions

View File

@ -1077,6 +1077,19 @@ class GrantBenefitProfile(models.Model):
res['domain'] = {'items': [('room_id', 'in', items_ids)]}
return res
@api.onchange('branch_family_id')
def _onchange_branch_family_id(self):
if self.branch_family_id:
branch = self.branch_family_id
if branch.has_employees:
chosen_branch = branch
else:
chosen_branch = branch.replacement_branch_id
self.branch_custom_id = chosen_branch
else:
self.branch_custom_id = False
@api.onchange("father_country_id", 'mother_country_id')
def onchange_father_mother_country_id(self):
res = {}

View File

@ -744,6 +744,10 @@ class BranchSettings(models.Model):
string='Branch Type')
city_id = fields.Many2one('res.country.city')
has_employees = fields.Boolean('Has Employees' ,defualt=True)
replacement_branch_id = fields.Many2one(
'branch.settings',
string="Replacement Branch"
)
class RelationSettings(models.Model):
_name = 'relation.settings'

View File

@ -992,6 +992,8 @@
</group>
<group>
<field name="has_employees"/>
<field name="replacement_branch_id"
attrs="{'required':[('has_employees','=',False)]}"/>
</group>
</group>
</sheet>

View File

@ -569,13 +569,13 @@
invisible="1"
string="City" options="{'no_create': True, 'no_create_edit': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="branch_family_id"
readonly="1"
options="{'no_create': True, 'no_create_edit': True}"/>
<field name="branch_custom_id"
readonly="1"
options="{'no_create': True, 'no_create_edit': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="branch_family_id"
readonly="1"
options="{'no_create': True, 'no_create_edit': True}"/>
<field name="branch_has_employees" invisible="1"/>
<field name="district_id"
attrs="{'readonly':[('state', 'not in', ['draft', 'new', 'complete_info'])]}"