Merge pull request #6239 from expsa/kch
[IMP] odex_benefit: IMP benefit
This commit is contained in:
commit
f3608de221
|
|
@ -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
|
||||
#: code:addons/odex_benefit/models/death_reason_settings.py:0
|
||||
#: model:ir.model.constraint,message:odex_benefit.constraint_death_reason_settings_uniq_name
|
||||
|
|
|
|||
|
|
@ -1664,9 +1664,10 @@ class GrantBenefitProfile(models.Model):
|
|||
if messages:
|
||||
raise UserError("\n".join(messages))
|
||||
|
||||
if not rec.user_id:
|
||||
self.sudo().create_user()
|
||||
#if not rec.user_id:
|
||||
# self.sudo().create_user()
|
||||
|
||||
if rec.user_id:
|
||||
rec.user_id.sudo().write({
|
||||
'groups_id': [(3, self.env.ref('base.group_user', False).id)],
|
||||
})
|
||||
|
|
@ -1795,14 +1796,14 @@ class GrantBenefitProfile(models.Model):
|
|||
|
||||
# @api.multi
|
||||
def action_edit_info(self):
|
||||
user = self.user_id
|
||||
if not user:
|
||||
user = self.env['res.users'].sudo().search(
|
||||
[('partner_id', '=', self.partner_id.id), ('active', '=', False)])
|
||||
if user:
|
||||
user.write({'active': True})
|
||||
else:
|
||||
user = self.create_user()
|
||||
#user = self.user_id
|
||||
#if not user:
|
||||
# user = self.env['res.users'].sudo().search(
|
||||
# [('partner_id', '=', self.partner_id.id), ('active', '=', False)])
|
||||
# if user:
|
||||
# user.write({'active': True})
|
||||
# else:
|
||||
# user = self.create_user()
|
||||
#group_e = self.env.ref('odex_benefit.group_benefit_edit', False)
|
||||
try:
|
||||
#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."))
|
||||
|
||||
# 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)
|
||||
benefit_exist = self.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)
|
||||
|
||||
if partner_exist or benefit_exist:
|
||||
raise ValidationError(_("The account number already exists!"))
|
||||
#if partner_exist or benefit_exist:
|
||||
# raise ValidationError(_("The account number already exists!"))
|
||||
|
||||
@api.onchange('mother_marital_conf', 'mother_location_conf', 'mother_net_income')
|
||||
def _onchange_mother_info(self):
|
||||
|
|
|
|||
|
|
@ -422,18 +422,24 @@ class FamilyMemberProfile(models.Model):
|
|||
"Numbers and special characters are not allowed.") % field_label
|
||||
)
|
||||
|
||||
@api.depends('age')
|
||||
@api.depends('age', 'relationn')
|
||||
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:
|
||||
current_education_status_id = rec.member_education_status_ids.filtered(
|
||||
lambda r: r.education_status_type == 'current')
|
||||
if rec.relationn.relation_type == 'son' and rec.age <= 18:
|
||||
rec.age_status = 'minor'
|
||||
elif rec.relationn.relation_type == 'daughter' and rec.age <= 26:
|
||||
rec.age_status = 'minor'
|
||||
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):
|
||||
rec.age_status = 'minor'
|
||||
if not rec.relationn or not rec.relationn.relation_type:
|
||||
rec.age_status = 'non_minor'
|
||||
continue
|
||||
|
||||
age = rec.age or 0
|
||||
rtype = rec.relationn.relation_type
|
||||
|
||||
if rtype == 'daughter':
|
||||
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:
|
||||
rec.age_status = 'non_minor'
|
||||
|
||||
|
|
@ -910,7 +916,7 @@ class FamilyMemberProfile(models.Model):
|
|||
|
||||
def action_resume_member(self):
|
||||
ctx = dict(self.env.context or {})
|
||||
#ctx['resume_family'] = True
|
||||
# ctx['resume_family'] = True
|
||||
ctx.update({
|
||||
'resume_family': True,
|
||||
'active_model': 'family.member',
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@
|
|||
'invisible':[('father_dead_reason_id_not_defined', '=', False)],
|
||||
'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'])]}"/>
|
||||
<field name="father_dead_country_id" required="1"
|
||||
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"
|
||||
|
|
|
|||
|
|
@ -366,6 +366,13 @@
|
|||
decoration-danger="state in ['refused','suspended_second_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')"/>
|
||||
<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>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
Loading…
Reference in New Issue