[IMP] odex_benefit: IMP benefit
This commit is contained in:
parent
1bbd906ebb
commit
9159dbd183
|
|
@ -18094,11 +18094,15 @@ msgid "Resume Approval by Family Services Manager"
|
|||
msgstr "اعتماد مديرة خدمات المستفيدين للإعادة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.family_member_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||
msgid "Resume Family Service"
|
||||
msgstr "إعادة الأسرة للخدمة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.family_member_form
|
||||
msgid "Resume Member Service"
|
||||
msgstr "إعادة الفرد للخدمة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.family_member_form
|
||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
|
||||
|
|
|
|||
|
|
@ -567,6 +567,7 @@ class FamilyMemberProfile(models.Model):
|
|||
'member_location_conf',
|
||||
'state',
|
||||
'is_dead',
|
||||
'is_work',
|
||||
'benefit_id.member_ids.member_status',
|
||||
)
|
||||
def check_member_status(self):
|
||||
|
|
@ -698,8 +699,7 @@ class FamilyMemberProfile(models.Model):
|
|||
elif rec.minor_siblings and rec.age > minor_siblings_age:
|
||||
rec.member_status = 'non_benefit'
|
||||
reasons.append(_("She is over %s years of age.") % minor_siblings_age)
|
||||
if rec.is_work and rec.member_income > max_income_for_benefit and rec.education_status in [
|
||||
'educated'] and current_education_status_id.case_study == 'continuous':
|
||||
if rec.is_work and rec.member_income > max_income_for_benefit:
|
||||
rec.member_status = 'non_benefit'
|
||||
reasons.append(_("She works with a salary greater than %s.") % max_income_for_benefit)
|
||||
if rec.is_work and rec.education_status in ['illiterate']:
|
||||
|
|
@ -892,6 +892,11 @@ class FamilyMemberProfile(models.Model):
|
|||
|
||||
# Member Suspend Manual
|
||||
def action_suspend(self):
|
||||
ctx = dict(self.env.context or {})
|
||||
ctx.update({
|
||||
'active_model': 'family.member',
|
||||
'active_id': self.id,
|
||||
})
|
||||
return {
|
||||
'name': _('Suspend Reason Wizard'),
|
||||
'view_mode': 'form',
|
||||
|
|
@ -900,11 +905,17 @@ class FamilyMemberProfile(models.Model):
|
|||
'res_model': 'suspend.reason.wizard',
|
||||
'view_id': self.env.ref('odex_benefit.view_suspend_member_reason_wizard_form').id,
|
||||
'target': 'new',
|
||||
'context': ctx,
|
||||
}
|
||||
|
||||
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',
|
||||
'active_id': self.id,
|
||||
})
|
||||
return {
|
||||
'name': _('Resume Reason Wizard'),
|
||||
'view_mode': 'form',
|
||||
|
|
@ -951,6 +962,7 @@ class FamilyMemberProfile(models.Model):
|
|||
rec.state_a = 'family_services_manager'
|
||||
else:
|
||||
rec.state_a = 'second_approve'
|
||||
rec.is_member_workflow = False
|
||||
rec.action_type = 'approved'
|
||||
|
||||
def action_suspend_third_accept(self):
|
||||
|
|
@ -963,6 +975,7 @@ class FamilyMemberProfile(models.Model):
|
|||
def action_resume_third_accept(self):
|
||||
for rec in self:
|
||||
rec.state_a = 'second_approve'
|
||||
rec.is_member_workflow = False
|
||||
rec.action_type = 'approved'
|
||||
|
||||
def action_suspend_refuse(self):
|
||||
|
|
@ -1136,28 +1149,28 @@ class FamilyMemberProfile(models.Model):
|
|||
for record in self:
|
||||
if not record.member_phone:
|
||||
continue
|
||||
|
||||
|
||||
phone = record.member_phone
|
||||
|
||||
|
||||
# Remove +966 prefix if present
|
||||
if phone.startswith('+966'):
|
||||
phone = phone[4:]
|
||||
record.member_phone = phone
|
||||
|
||||
|
||||
# Validate Saudi mobile pattern
|
||||
if re.match(SAUDI_MOBILE_PATTERN, phone) is None:
|
||||
raise ValidationError(
|
||||
_('Enter a valid Saudi mobile number'))
|
||||
|
||||
|
||||
# Check phone against family's main phones
|
||||
if record.benefit_id and phone in [
|
||||
record.benefit_id.phone,
|
||||
record.benefit_id.phone2,
|
||||
record.benefit_id.phone,
|
||||
record.benefit_id.phone2,
|
||||
record.benefit_id.sms_phone
|
||||
]:
|
||||
raise ValidationError(
|
||||
_("Phone number cannot be the same in The Family"))
|
||||
|
||||
|
||||
# Check for duplicate phone in other members (excluding current record)
|
||||
exist = self.search([
|
||||
('member_phone', '=', phone),
|
||||
|
|
@ -1166,7 +1179,7 @@ class FamilyMemberProfile(models.Model):
|
|||
if exist:
|
||||
raise ValidationError(
|
||||
_("The phone Number already exists in Family with code %s") % exist.benefit_id.code)
|
||||
|
||||
|
||||
# Check if phone exists in grant.benefit
|
||||
exist_in_family = self.env["grant.benefit"].search([
|
||||
'|', '|',
|
||||
|
|
|
|||
|
|
@ -13,44 +13,44 @@
|
|||
confirm="Are you sure you want to move to Temporarily Suspended ?"/>
|
||||
<button name="action_suspend_first_accept" type="object"
|
||||
string="First Approve" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('action_type','!=','suspended'),('state', 'not in', ['waiting_approve'])]}"
|
||||
attrs="{'invisible': ['|','|',('action_type','!=','suspended'),('state', 'not in', ['waiting_approve']),('is_member_workflow','=',False)]}"
|
||||
/>
|
||||
<button name="action_suspend_second_accept" type="object"
|
||||
string="Second Approve" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('action_type','!=','suspended'),('state', 'not in', ['first_approve'])]}"
|
||||
attrs="{'invisible': ['|','|',('action_type','!=','suspended'),('state', 'not in', ['first_approve']),('is_member_workflow','=',False)]}"
|
||||
/>
|
||||
<button name="action_suspend_third_accept" type="object"
|
||||
string="Third Approve" class="oe_highlight"
|
||||
groups="odex_benefit.group_benefit_manager"
|
||||
attrs="{'invisible': ['|',('action_type','!=','suspended'),('state', 'not in', ['family_services_manager'])]}"/>
|
||||
attrs="{'invisible': ['|','|',('action_type','!=','suspended'),('state', 'not in', ['family_services_manager']),('is_member_workflow','=',False)]}"/>
|
||||
<button name="action_resume_first_accept" type="object"
|
||||
string="Resume Approval by Operations Head" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['waiting_approve'])]}"
|
||||
attrs="{'invisible': ['|','|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['waiting_approve']),('is_member_workflow','=',False)]}"
|
||||
groups="odex_benefit.group_benefit_woman_commitee,odex_benefit.group_benefit_manager"
|
||||
/>
|
||||
<button name="action_resume_second_accept" type="object"
|
||||
string="Resume Approval by Branch Manager" class="oe_highlight"
|
||||
groups="odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"
|
||||
attrs="{'invisible': ['|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['first_approve'])]}"/>
|
||||
attrs="{'invisible': ['|','|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['first_approve']),('is_member_workflow','=',False)]}"/>
|
||||
<button name="action_resume_third_accept" type="object"
|
||||
string="Resume Approval by Family Services Manager" class="oe_highlight"
|
||||
groups="odex_benefit.group_benefit_manager"
|
||||
attrs="{'invisible': ['|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['family_services_manager'])]}"/>
|
||||
<button name="action_resume_member" string="Resume Family Service"
|
||||
attrs="{'invisible': ['|','|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['family_services_manager']),('is_member_workflow','=',False)]}"/>
|
||||
<button name="action_resume_member" string="Resume Member Service"
|
||||
type="object" class="btn btn-success"
|
||||
attrs="{'invisible': [('state', 'not in', ['temporary_suspended', 'suspended_second_approve'])]}"
|
||||
attrs="{'invisible': ['|',('state', 'not in', ['temporary_suspended', 'suspended_second_approve']),('is_member_workflow','=',False)]}"
|
||||
groups="odex_benefit.group_benefit_researcher"/>
|
||||
<button name="action_final_suspend" type="object"
|
||||
string="Final Suspension" class="btn btn-danger"
|
||||
attrs="{'invisible': [('state', '!=', 'temporary_suspended')]}"
|
||||
attrs="{'invisible': ['|',('state', '!=', 'temporary_suspended'),('is_member_workflow','=',False)]}"
|
||||
groups="odex_benefit.group_benefit_manager"/>
|
||||
<button name="action_reject_resume" type="object"
|
||||
string="Reject Resume" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['waiting_approve','first_approve','family_services_manager'])]}"
|
||||
attrs="{'invisible': ['|','|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['waiting_approve','first_approve','family_services_manager']),('is_member_workflow','=',False)]}"
|
||||
/>
|
||||
<button name="action_suspend_refuse" type="object"
|
||||
string="Suspend Refuse" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('action_type','!=','suspended'),('state', 'not in', ['waiting_approve','first_approve','family_services_manager','suspended_second_approve'])]}"
|
||||
attrs="{'invisible': ['|','|',('action_type','!=','suspended'),('state', 'not in', ['waiting_approve','first_approve','family_services_manager','suspended_second_approve']),('is_member_workflow','=',False)]}"
|
||||
/>
|
||||
<!-- Exception -->
|
||||
<button name="action_exception" type="object"
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ class SuspendReasonWizard(models.TransientModel):
|
|||
action_type = ('resume_from_temporary'
|
||||
if benefit.state == 'temporary_suspended'
|
||||
else 'resume_from_final')
|
||||
benefit.member_ids.write({
|
||||
'action_type': action_type,
|
||||
})
|
||||
vals = {
|
||||
'state': 'waiting_approve',
|
||||
'action_type': action_type,
|
||||
|
|
@ -97,6 +100,7 @@ class SuspendReasonWizard(models.TransientModel):
|
|||
'is_excluded_suspension': False,
|
||||
'is_member_workflow': False,
|
||||
'final_suspend_date': rec.final_suspend_date,
|
||||
'action_type': 'suspended',
|
||||
})
|
||||
if rec.suspend_attachment:
|
||||
attachment = rec._create_attachment_record_from_binary()
|
||||
|
|
|
|||
Loading…
Reference in New Issue