This commit is contained in:
eman 2024-09-29 04:17:24 +03:00
parent 32afdd90fa
commit bda8bf75ab
4 changed files with 98 additions and 46 deletions

View File

@ -158,6 +158,8 @@ class GrantBenefitProfile(models.Model):
father_dead_city_id = fields.Many2one('res.country.city', string='Dead City')
father_dead_certificate = fields.Binary(attachment=True, string='Father Dead Certificate')
# Mother's case and her data # Birth Date # Address # dead data
mother_relation = fields.Selection(
[('mother', _('Mother')),('replacement_mother', _('Replacement Mother'))])
mother_id = fields.Many2one('grant.benefit', domain="[('benefit_type','!=','orphan'),('gender','=','female')]")
mother_name = fields.Char(string="Mother Name", tracking=True)
mother_second_name = fields.Char(string="Mother Second Name", tracking=True)
@ -679,6 +681,12 @@ class GrantBenefitProfile(models.Model):
# raise UserError(_('You cannot register outside Saudi Arabia'))
return res
def unlink(self):
for order in self:
if order.state not in ['draft','complete_info','waiting_approve']:
raise UserError(_('You cannot delete this record'))
return super(GrantBenefitProfile, self).unlink()
def complete_data(self):
message = self.create_message('complete_info')
self.partner_id.send_sms_notification(message, self.phone)
@ -1124,7 +1132,7 @@ class GrantBenefitProfile(models.Model):
'member_id_number': rec.mother_id_number,
'birth_date': rec.mother_birth_date,
'gender': 'female',
'relation': 'mother',
'mother_relation': rec.mother_relation,
'mother_marital': rec.mother_marital,
'mother_location': rec.mother_location,
'age': rec.mother_age,
@ -1167,7 +1175,7 @@ class GrantBenefitProfile(models.Model):
'member_id_number': rec.mother_id_number,
'birth_date': rec.mother_birth_date,
'gender': 'female',
'relation': 'mother',
'mother_relation': rec.mother_relation,
'mother_marital': rec.mother_marital,
'mother_location': rec.mother_location,
'age': rec.mother_age,

View File

@ -42,7 +42,9 @@ class FamilyMemberProfile(models.Model):
member_income = fields.Float('Member Income')
is_married = fields.Boolean('Is Married?')
relation = fields.Selection(
[('son', _('Son')), ('daughter', _('Daughter')), ('mother', _('Mother')),('replacement_mother', _('Replacement Mother'))])
[('son', _('Son')), ('daughter', _('Daughter'))])
mother_relation = fields.Selection(
[('mother', _('Mother')), ('replacement_mother', _('Replacement Mother'))])
mother_marital = fields.Selection(
[('married', _('Married')), ('widower', _('Widower')), ('divorced', _('Divorced')),
('divorced_from_another_man', _('Divorced From Another Man')), ('prisoner', _('Prisoner')),
@ -184,7 +186,7 @@ class FamilyMemberProfile(models.Model):
minor_siblings_age = validation_setting.minor_siblings_age
max_income_for_benefit = validation_setting.max_income_for_benefit
rec.member_status = 'benefit' # Default to benefit
if rec.relation == 'mother':
if rec.mother_relation == 'mother':
rec.member_status = rec.benefit_id.mother_status
if rec.state == 'suspended_second_approve':
rec.member_status = 'non_benefit'

View File

@ -179,50 +179,48 @@
</div>
<group>
<group>
<field name="meal_card" readonly="1"/>
<field name="email"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'required':True}"/>
<field name="phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'required':True}"/>
<field name="phone2"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="relative_phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="relative_relation"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="sms_phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'required':True}"/>
<field name="first_refusal_reason"
attrs="{'invisible':[('state','!=','first_refusal')]}"/>
<field name="first_refuse_date"
attrs="{'invisible':[('state','!=','first_refusal')]}"/>
<field name="is_excluded_suspension" groups="odex_benefit.group_benefit_manager,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_woman_commitee"/>
<field name="meal_card" readonly="1" invisible="1"/>
<field name="sponsor_id" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="researcher_id"
attrs="{'readonly':[('state','not in',['draft','complete_info'])],'required':[('state','not in',['draft'])]}"/>
<field name="last_visit_date" readonly="1"/>
</group>
<group>
<!-- <field name="family_bank"-->
<!-- attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>-->
<field name="acc_number" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
<field name="acc_holder_name" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
<field name="bank_id" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
<!-- <field name="iban" readonly="1" force_save="1"/>-->
<field name="is_zakat_fitr" widget="boolean_toggle"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_food_basket" widget="boolean_toggle"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<!-- <field name="is_producer" widget="boolean_toggle"/>-->
<field name="benefit_category_id" attrs="{'invisible':[('state','=','draft')]}"
readonly="1"/>
<field name="benefit_category_id" readonly="1"/>
<field name="member_income" readonly="1"/>
<field name="request_producer"
attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
<field name="researcher_id"
attrs="{'readonly':[('state','not in',['draft','complete_info'])],'required':[('state','not in',['draft'])]}"/>
<field name="last_visit_date" readonly="1"/>
</group>
</group>
<notebook>
<page string="Contact Information">
<form>
<sheet>
<group>
<group>
<field name="email"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'required':True}"/>
<field name="sms_phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'required':True}"/>
</group>
<group>
<field name="phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="phone2"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="relative_phone"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}" invisible="1"/>
<field name="relative_relation"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}" invisible="1"/>
</group>
</group>
</sheet>
</form>
</page>
<page string="Father Information">
<h3>Father</h3>
<group>
@ -263,6 +261,7 @@
attrs="{'invisible': [('mother_status', '!=', 'benefit')]}"/>
<group>
<group>
<field name="mother_relation" class="oe_inline"/>
<field name="mother_name"
attrs="{'required':[('state','!=','draft')],'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="mother_second_name"
@ -363,12 +362,18 @@
<widget name="web_ribbon" title="Benefit Member" bg_color="bg-success"
attrs="{'invisible': [('member_status', '!=', 'benefit')]}"/>
<sheet>
<group>
<label for="relation" string="Relation"/>
<div>
<field name="relation" class="oe_inline" nolabel="1" required="1"/>
<group attrs="{'invisible':[('mother_relation','!=',False)]}">
<label for="relation" string="Relation" attrs="{'invisible':[('mother_relation','!=',False)]}"/>
<div attrs="{'invisible':[('mother_relation','!=',False)]}">
<field name="relation" class="oe_inline" nolabel="1" attrs="{'readonly':[('parent.state','not in',['draft','complete_info','edit_info'])],'invisible':[('mother_relation','!=',False)],'required':[('relation','!=',False)]}"/>
</div>
</group>
</group>
<group attrs="{'invisible':[('relation','!=',False)]}">
<label for="mother_relation" string="Relation" attrs="{'invisible':[('relation','!=',False)]}"/>
<div attrs="{'invisible':[('relation','!=',False)]}">
<field name="mother_relation" class="oe_inline" nolabel="1" attrs="{'readonly':[('parent.state','not in',['draft','complete_info','edit_info'])],'invisible':[('relation','!=',False)],'required':[('mother_relation','!=',False)]}"/>
</div>
</group>
<group>
<group>
<field placeholder="Name" name="name" class="oe_inline" readonly="1"
@ -518,6 +523,21 @@
</form>
</field>
</page>
<page string="Bank Account Information">
<form>
<sheet>
<group>
<group>
<field name="acc_number" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
<field name="acc_holder_name" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
</group>
<group>
<field name="bank_id" attrs="{'readonly':[('state','not in',['draft','complete_info'])]}"/>
</group>
</group>
</sheet>
</form>
</page>
<page string="Housing information">
<form string="Housing">
<sheet>
@ -826,6 +846,15 @@
</tree>
</field>
</page>
<page string="First Refusal Reason"
attrs="{'invisible': [('state', 'not in', ['first_refusal'])]}">
<group>
<field name="first_refusal_reason"
attrs="{'invisible':[('state','!=','first_refusal')]}"/>
<field name="first_refuse_date"
attrs="{'invisible':[('state','!=','first_refusal')]}"/>
</group>
</page>
<page string="Suspend Reason"
attrs="{'invisible': [('state', 'not in', ['temporarily_suspended','suspended_first_approve','suspended_second_approve'])]}">
<group>
@ -862,6 +891,13 @@
<!-- <field name="is_divorcee" widget="boolean_toggle"/>-->
<!-- </group>-->
<!-- </group>-->
<group>
<field name="is_zakat_fitr" widget="boolean_toggle"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_food_basket" widget="boolean_toggle"
attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_excluded_suspension" groups="odex_benefit.group_benefit_manager,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_woman_commitee"/>
</group>
<group>
<field name="partner_id" readonly="1" required="0" force_save="1" string="Partner"/>
<field name="user_id" readonly="1" force_save="1"/>

View File

@ -69,10 +69,16 @@
<field placeholder="Name" name="name" class="oe_inline" readonly="1"
force_save="1"/>
</h1>
<group>
<label for="relation" string="Relation"/>
<div>
<field name="relation" class="oe_inline" nolabel="1" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}" required="1"/>
<group attrs="{'invisible':[('mother_relation','!=',False)]}">
<label for="relation" string="Relation" attrs="{'invisible':[('mother_relation','!=',False)]}"/>
<div attrs="{'invisible':[('mother_relation','!=',False)]}">
<field name="relation" class="oe_inline" nolabel="1" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'invisible':[('mother_relation','!=',False)],'required':[('relation','!=',False)]}"/>
</div>
</group>
<group attrs="{'invisible':[('relation','!=',False)]}">
<label for="mother_relation" string="Relation" attrs="{'invisible':[('relation','!=',False)]}"/>
<div attrs="{'invisible':[('relation','!=',False)]}">
<field name="mother_relation" class="oe_inline" nolabel="1" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])],'invisible':[('relation','!=',False)],'required':[('mother_relation','!=',False)]}"/>
</div>
</group>
<group>
@ -97,8 +103,8 @@
<field name="is_married" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_alhaju" widget="boolean_toggle" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_amra" widget="boolean_toggle" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="mother_marital" attrs="{'invisible':[('relation','!=','mother')]}"/>
<field name="mother_location" attrs="{'invisible':[('relation','!=','mother')]}"/>
<field name="mother_marital" attrs="{'invisible':[('relation','!=',False)]}"/>
<field name="mother_location" attrs="{'invisible':[('relation','!=',False)]}"/>
<field name="benefit_id" attrs="{'readonly': [('state','!=','draft')]}" force_save="1" required="1"/>
<field name="member_status" readonly="1" widget="badge" decoration-success="member_status == 'benefit'" decoration-danger="member_status == 'non_benefit'"/>