Merge pull request #6239 from expsa/kch

[IMP] odex_benefit: IMP benefit
This commit is contained in:
kchyounes19 2026-01-19 12:51:24 +01:00 committed by GitHub
commit f3608de221
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 49 additions and 41 deletions

View File

@ -11469,12 +11469,6 @@ msgstr ""
"رقم التعريف الضريبي. قم بإكماله إذا كانت جهة الاتصال تخضع للضرائب الحكومية. " "رقم التعريف الضريبي. قم بإكماله إذا كانت جهة الاتصال تخضع للضرائب الحكومية. "
"يُستخدم في بعض المستندات القانونية." "يُستخدم في بعض المستندات القانونية."
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#, python-format
msgid "The account number already exists!"
msgstr ""
#. module: odex_benefit #. module: odex_benefit
#: code:addons/odex_benefit/models/death_reason_settings.py:0 #: code:addons/odex_benefit/models/death_reason_settings.py:0
#: model:ir.model.constraint,message:odex_benefit.constraint_death_reason_settings_uniq_name #: model:ir.model.constraint,message:odex_benefit.constraint_death_reason_settings_uniq_name

View File

@ -1664,9 +1664,10 @@ class GrantBenefitProfile(models.Model):
if messages: if messages:
raise UserError("\n".join(messages)) raise UserError("\n".join(messages))
if not rec.user_id: #if not rec.user_id:
self.sudo().create_user() # self.sudo().create_user()
if rec.user_id:
rec.user_id.sudo().write({ rec.user_id.sudo().write({
'groups_id': [(3, self.env.ref('base.group_user', False).id)], 'groups_id': [(3, self.env.ref('base.group_user', False).id)],
}) })
@ -1795,14 +1796,14 @@ class GrantBenefitProfile(models.Model):
# @api.multi # @api.multi
def action_edit_info(self): def action_edit_info(self):
user = self.user_id #user = self.user_id
if not user: #if not user:
user = self.env['res.users'].sudo().search( # user = self.env['res.users'].sudo().search(
[('partner_id', '=', self.partner_id.id), ('active', '=', False)]) # [('partner_id', '=', self.partner_id.id), ('active', '=', False)])
if user: # if user:
user.write({'active': True}) # user.write({'active': True})
else: # else:
user = self.create_user() # user = self.create_user()
#group_e = self.env.ref('odex_benefit.group_benefit_edit', False) #group_e = self.env.ref('odex_benefit.group_benefit_edit', False)
try: try:
#group_e.sudo().write({'users': [(4, user.id)]}) #group_e.sudo().write({'users': [(4, user.id)]})
@ -2640,11 +2641,11 @@ class GrantBenefitProfile(models.Model):
raise ValidationError(_("The IBAN number must contain exactly 22 digits.")) raise ValidationError(_("The IBAN number must contain exactly 22 digits."))
# Check if the account number already exists in the partner bank or benefit # Check if the account number already exists in the partner bank or benefit
partner_exist = self.env['res.partner.bank'].search([('acc_number', '=', self.acc_number)], limit=1) #partner_exist = self.env['res.partner.bank'].search([('acc_number', '=', self.acc_number)], limit=1)
benefit_exist = self.search([('acc_number', '=', self.acc_number)], limit=1) #benefit_exist = self.search([('acc_number', '=', self.acc_number)], limit=1)
if partner_exist or benefit_exist: #if partner_exist or benefit_exist:
raise ValidationError(_("The account number already exists!")) # raise ValidationError(_("The account number already exists!"))
@api.onchange('mother_marital_conf', 'mother_location_conf', 'mother_net_income') @api.onchange('mother_marital_conf', 'mother_location_conf', 'mother_net_income')
def _onchange_mother_info(self): def _onchange_mother_info(self):

View File

@ -422,18 +422,24 @@ class FamilyMemberProfile(models.Model):
"Numbers and special characters are not allowed.") % field_label "Numbers and special characters are not allowed.") % field_label
) )
@api.depends('age') @api.depends('age', 'relationn')
def _compute_get_age_status(self): def _compute_get_age_status(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
female_benefit_age = validation_setting.female_benefit_age or 26
male_benefit_age = validation_setting.male_benefit_age or 18
for rec in self: for rec in self:
current_education_status_id = rec.member_education_status_ids.filtered( if not rec.relationn or not rec.relationn.relation_type:
lambda r: r.education_status_type == 'current') rec.age_status = 'non_minor'
if rec.relationn.relation_type == 'son' and rec.age <= 18: continue
rec.age_status = 'minor'
elif rec.relationn.relation_type == 'daughter' and rec.age <= 26: age = rec.age or 0
rec.age_status = 'minor' rtype = rec.relationn.relation_type
elif rec.relationn.relation_type == 'son' and rec.age <= 22 and (
current_education_status_id.specialization_ids.is_scientific_specialty or current_education_status_id.specialization_ids.is_medical_specialty): if rtype == 'daughter':
rec.age_status = 'minor' rec.age_status = 'minor' if age < female_benefit_age else 'non_minor'
elif rtype == 'son':
rec.age_status = 'minor' if age < male_benefit_age else 'non_minor'
else: else:
rec.age_status = 'non_minor' rec.age_status = 'non_minor'

View File

@ -708,7 +708,7 @@
'invisible':[('father_dead_reason_id_not_defined', '=', False)], 'invisible':[('father_dead_reason_id_not_defined', '=', False)],
'readonly':[('state','not in',['draft','new','complete_info'])]} 'readonly':[('state','not in',['draft','new','complete_info'])]}
"/> "/>
<field name="father_dead_date" required="1" <field name="father_dead_date" required="0"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"/> attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="father_dead_country_id" required="1" <field name="father_dead_country_id" required="1"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}" attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"

View File

@ -366,6 +366,13 @@
decoration-danger="state in ['refused','suspended_second_approve']" decoration-danger="state in ['refused','suspended_second_approve']"
decoration-warning="state in ['first_refusal','waiting_approve']" decoration-warning="state in ['first_refusal','waiting_approve']"
decoration-info="state not in ('waiting_approve','draft','new','first_approve', 'second_approve','first_refusal','refused','suspended_second_approve')"/> decoration-info="state not in ('waiting_approve','draft','new','first_approve', 'second_approve','first_refusal','refused','suspended_second_approve')"/>
<field name="action_type" widget="badge" optional="show"
decoration-muted="action_type == 'new'"
decoration-info="action_type == 'edit_info'"
decoration-success="action_type == 'approved'"
decoration-danger="action_type == 'suspended'"
decoration-warning="action_type in ['resume_from_temporary', 'exception']"
decoration-primary="action_type == 'resume_from_final'"/>
</tree> </tree>
</field> </field>
</record> </record>