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