IMP benefit

This commit is contained in:
younes 2025-09-08 15:57:41 +01:00
parent 66efb123b0
commit f64e07291d
8 changed files with 284 additions and 236 deletions

View File

@ -720,7 +720,6 @@ msgstr ""
#. module: odex_benefit
#: code:addons/odex_benefit/models/benefit.py:0
#: code:addons/odex_benefit/wizards/entity_black_list_wizard.py:0
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
msgid " State changed to "
msgstr " تم تغيير الحالة الى "
@ -8768,6 +8767,8 @@ msgstr "جوار السكن"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_benefits_representative__comment
#: model:ir.model.fields,field_description:odex_benefit.field_entity_refused_reason_wizard__refused_reason
#: model:ir.model.fields,field_description:odex_benefit.field_entity_return_reason_wizard__return_reason
#: model:ir.model.fields,field_description:odex_benefit.field_external_benefits__comment
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__comment
#: model:ir.model.fields,field_description:odex_benefit.field_service_attachments_settings__notes
@ -9548,6 +9549,7 @@ msgid "Rate of zkat"
msgstr ""
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_entity_return_reason_wizard__return_reason
#: model:ir.model.fields,field_description:odex_benefit.field_family_member__reason
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__reason
#: model:ir.model.fields,field_description:odex_benefit.field_service_refuse_reason__name
@ -11018,12 +11020,10 @@ msgid "Suspend Method"
msgstr "طريقة الإيقاف"
#. module: odex_benefit
#: model:ir.actions.act_window,name:odex_benefit.suspend_reason_action
#: model:ir.model.fields,field_description:odex_benefit.field_entity_refused_reason_wizard__suspend_reason_id
#: model:ir.model.fields,field_description:odex_benefit.field_family_member__suspend_reason
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__suspend_reason
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason_wizard__suspend_reason
#: model:ir.ui.menu,name:odex_benefit.menu_suspend_reason
#: model_terms:ir.actions.act_window,help:odex_benefit.suspend_reason_action
#: 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 "Suspend Reason"
@ -11134,12 +11134,6 @@ msgstr "المستفيد "
msgid "The Beneficiaries "
msgstr "المستفيدين "
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
msgid "The Benefit "
msgstr "المستفيد "
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
@ -14700,23 +14694,15 @@ msgid "Return Reason Wizard"
msgstr "سبب الإرجاع"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_entity_return_reason_wizard_form
msgid "Retrun"
msgstr "إرجاع"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_entity_return_reason_wizard__return_reason
#: model:ir.model.fields,field_description:odex_benefit.field_entity_return_reason_wizard__suspend_reason_id
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason__is_return_reason
msgid "Return Reason"
msgstr "سبب الإرجاع"
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
msgid ""
"The benefit record <b>%s</b> state has been changed to <b>%s</b>.<br/>Return"
" Reason: <b>%s</b>"
msgstr ""
"تم تغيير حالة المستفيد <b>%s</b> إلى <b>%s</b>.<br/>سبب الإرجاع: <b>%s</b>"
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_entity_return_reason_wizard_form
msgid "Retrun"
msgstr "إرجاع"
#. module: odex_benefit
#: code:addons/odex_benefit/models/res_users.py:0
@ -15282,6 +15268,7 @@ msgstr "تعديل العائلة"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__family_return_reason
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason__is_family_return_reason
msgid "Family Return Reason"
msgstr "سبب ارجاع للاسرة"
@ -15357,3 +15344,41 @@ msgstr "دولة وفاة الأم البديلة"
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__replacement_dead_reason_id
msgid "Replacement Mother Dead Reason"
msgstr "سبب وفاة الأم البديلة"
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
msgid ""
"The benefit record <b>%s</b> state has been changed to <b>%s</b>.<br/>Return"
" Reason: <b>%s</b><br/>Reason: <b>%s</b>"
msgstr "تم تغيير حالة حالة المستفيد <b>%s</b> إلى <b>%s</b>.<br/>سبب الإرجاع: <b>%s</b><br/>الملاحظات: <b>%s</b>"
#. module: odex_benefit
#: code:addons/odex_benefit/wizards/entity_refused_wizard.py:0
#, python-format
msgid ""
"The Benefit <b>%s</b> state changed to <b>%s</b>.<br/>Suspend Reason: "
"<b>%s</b><br/>Reason: <b>%s</b>"
msgstr "تم تغيير حالة المستفيد <b>%s</b> إلى <b>%s</b>.<br/>سبب الإيقاف: <b>%s</b><br/>Notes: <b>%s</b>"
#. module: odex_benefit
#: model:ir.actions.act_window,name:odex_benefit.suspend_reason_action
#: model:ir.ui.menu,name:odex_benefit.menu_suspend_reason
#: model_terms:ir.actions.act_window,help:odex_benefit.suspend_reason_action
msgid "Reasons of Suspension and Refusal"
msgstr "أسباب الإيقاف والرفض"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason__is_stop_reason
msgid "Stop Reason"
msgstr "سبب إيقاف"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason__is_reject_reason
msgid "Reject Reason"
msgstr "سبب الرفض"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_suspend_reason__is_incomplete_visit_reason
msgid "Incomplete Visit Reason"
msgstr "سبب عدم اكمال الزيارة"

View File

@ -397,7 +397,7 @@ class GrantBenefitProfile(models.Model):
support_separation = fields.Boolean(string="Support Separation", tracking=True)
is_life = fields.Boolean(string="Life", default=True)
total_expenses = fields.Float('Total Expenses', compute="get_total_expenses",store=True)
total_income = fields.Float('Total Income', compute="get_total_income")
total_income = fields.Float('Total Income', compute="get_total_income", store=True)
benefit_member_count = fields.Integer(string="Members count", compute="get_members_count")
non_member_count = fields.Integer(string="Non Benefit Members count", compute="get_non_members_count")
member_income = fields.Integer(string="Member Income Average", compute="get_member_income",store=True)
@ -638,7 +638,7 @@ class GrantBenefitProfile(models.Model):
pattern = re.compile(r'^[A-Za-z]{4}[0-9]{4}$')
for record in self:
if record.short_number and not pattern.match(record.short_number):
raise ValidationError("Short Number must be 4 letters followed by 4 digits (e.g., ABCD1234).")
raise ValidationError(_("Short Number must be 4 letters followed by 4 digits (e.g., ABCD1234)."))
@api.constrains('father_name', 'father_second_name', 'father_third_name', 'father_family_name',
@ -1794,8 +1794,14 @@ class GrantBenefitProfile(models.Model):
ben.expenses_total = len(expenses)
ben.total_expenses = total_expenses
@api.depends(
'mother_income',
'mother_status',
'replacement_mother_income',
'replacement_mother_status',
'salary_ids',
'salary_ids.approved',
)
def get_total_income(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
max_income_for_mother = validation_setting.max_income_for_mother
@ -2080,11 +2086,9 @@ class GrantBenefitProfile(models.Model):
else:
ben.non_member_count = 0.0
@api.depends('salary_ids','mother_income','member_ids','salary_ids.approved')
@api.depends('benefit_member_count','member_ids','total_income','total_expenses')
def get_member_income(self):
for ben in self:
# ben.get_total_income()
# ben.get_total_expenses()
family_income = ben.total_income - ben.total_expenses
if ben.benefit_member_count:
if ben.benefit_member_count > 3:

View File

@ -714,6 +714,12 @@ class SuspendReason(models.Model):
_description = "Suspend - Reason"
name = fields.Char(string="Name")
is_stop_reason = fields.Boolean(string="Stop Reason",default=False)
is_reject_reason = fields.Boolean(string="Reject Reason",default=False)
is_return_reason = fields.Boolean(string="Return Reason",default=False)
is_family_return_reason = fields.Boolean(string="Family Return Reason",default=False)
is_incomplete_visit_reason = fields.Boolean(string="Incomplete Visit Reason",default=False)
active = fields.Boolean(default=True)
class BranchSettings(models.Model):
_name = 'branch.settings'

View File

@ -287,11 +287,11 @@
</field>
</record>
<record model="ir.actions.act_window" id="suspend_reason_action">
<field name="name">Suspend Reason</field>
<field name="name">Reasons of Suspension and Refusal</field>
<field name="res_model">suspend.reason</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Suspend Reason
<p class="oe_view_nocontent_create">Reasons of Suspension and Refusal
</p>
</field>
</record>
@ -852,7 +852,7 @@
/>
<menuitem
id="menu_suspend_reason"
name="Suspend Reason"
name="Reasons of Suspension and Refusal"
parent="benefit_tools"
action="suspend_reason_action"
sequence="101"

View File

@ -30,16 +30,16 @@
<field name="mini_income_amount"/>
<field name="max_income_amount"/>
</group>
<!-- <group col="4" colspan="2">-->
<!-- <field name="gender" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <field name="description" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- </group>-->
<!-- <group col="6" colspan="3">-->
<!-- <field name="age_from" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <p>Year</p>-->
<!-- <field name="age_to" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <p>Year</p>-->
<!-- </group>-->
<!-- <group col="4" colspan="2">-->
<!-- <field name="gender" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <field name="description" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- </group>-->
<!-- <group col="6" colspan="3">-->
<!-- <field name="age_from" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <p>Year</p>-->
<!-- <field name="age_to" attrs="{'readonly':[('state','!=','draft')],'required':True}"/>-->
<!-- <p>Year</p>-->
<!-- </group>-->
<group>
<field name="expenses_ids">
<tree editable="bottom">
@ -61,7 +61,7 @@
<field name="name"/>
<field name="mini_income_amount"/>
<field name="max_income_amount"/>
<!-- <field name="gender"/>-->
<!-- <field name="gender"/>-->
</tree>
</field>
</record>
@ -389,19 +389,19 @@
</form>
</field>
</record>
<!-- <record id="grant_benefit_tree" model="ir.ui.view">-->
<!-- <field name="name">grant.benefit.tree</field>-->
<!-- <field name="model">grant.benefit</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Benefit" default_order="create_date">-->
<!-- &lt;!&ndash; <field name="code"/>&ndash;&gt;-->
<!-- <field name="name"/>-->
<!-- <field name="email"/>-->
<!-- <field name="phone"/>-->
<!-- <field name="state"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record id="grant_benefit_tree" model="ir.ui.view">-->
<!-- <field name="name">grant.benefit.tree</field>-->
<!-- <field name="model">grant.benefit</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Benefit" default_order="create_date">-->
<!-- &lt;!&ndash; <field name="code"/>&ndash;&gt;-->
<!-- <field name="name"/>-->
<!-- <field name="email"/>-->
<!-- <field name="phone"/>-->
<!-- <field name="state"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<!-- Rooms tree -->
<record id="housing_rooms_tree" model="ir.ui.view">
<field name="name">housing_rooms_tree</field>
@ -573,19 +573,19 @@
</tree>
</field>
</record>
<!-- <record id="grant_benefit_tree" model="ir.ui.view">-->
<!-- <field name="name">grant.benefit.tree</field>-->
<!-- <field name="model">grant.benefit</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Benefit" default_order="create_date">-->
<!-- &lt;!&ndash; <field name="code"/>&ndash;&gt;-->
<!-- <field name="name"/>-->
<!-- <field name="email"/>-->
<!-- <field name="phone"/>-->
<!-- <field name="state"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record id="grant_benefit_tree" model="ir.ui.view">-->
<!-- <field name="name">grant.benefit.tree</field>-->
<!-- <field name="model">grant.benefit</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Benefit" default_order="create_date">-->
<!-- &lt;!&ndash; <field name="code"/>&ndash;&gt;-->
<!-- <field name="name"/>-->
<!-- <field name="email"/>-->
<!-- <field name="phone"/>-->
<!-- <field name="state"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<record id="benefit_housing_kanban_view" model="ir.ui.view">
<field name="name">benefit.housing.kanban</field>
<field name="model">benefit.housing</field>
@ -697,8 +697,8 @@
<field name="description"/>
</group>
<group>
<field name="is_scientific_specialty"/>
<field name="is_medical_specialty"/>
<field name="is_scientific_specialty"/>
<field name="is_medical_specialty"/>
</group>
</group>
</sheet>
@ -801,15 +801,15 @@
</tree>
</field>
</record>
<!-- <record id="branch_settings_tree" model="ir.ui.view">-->
<!-- <field name="name">branch.settings.tree</field>-->
<!-- <field name="model">branch.settings</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Branch settings">-->
<!-- <field name="branch_id"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<!-- <record id="branch_settings_tree" model="ir.ui.view">-->
<!-- <field name="name">branch.settings.tree</field>-->
<!-- <field name="model">branch.settings</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <tree string="Branch settings">-->
<!-- <field name="branch_id"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </record>-->
<record id="districts_tree" model="ir.ui.view">
<field name="name">res.districts.tree</field>
@ -871,7 +871,8 @@
<group>
<field name="name"/>
<field name="creation_method"/>
<label for="recurrence_interval" attrs="{'invisible':[('creation_method','!=','automatic')]}"/>
<label for="recurrence_interval"
attrs="{'invisible':[('creation_method','!=','automatic')]}"/>
<div class="o_row" attrs="{'invisible':[('creation_method','!=','automatic')]}">
<field name="recurrence_interval" class="oe_inline" nolabel="1"/>
<field name="recurrence_period" class="oe_inline" nolabel="1"/>
@ -879,7 +880,8 @@
</group>
<group>
<field name="otp_verification" widget="boolean_toggle"/>
<field name="otp_validity_minutes" attrs="{'invisible':[('otp_verification','=',False)]}"/>
<field name="otp_validity_minutes"
attrs="{'invisible':[('otp_verification','=',False)]}"/>
<field name="survey_id"/>
</group>
</group>
@ -900,39 +902,50 @@
</field>
</record>
<record id="survey_setting_form" model="ir.ui.view">
<field name="name">Survey URL</field>
<field name="model">survey.setting</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="survey_url"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="survey_setting_tree" model="ir.ui.view">
<field name="name">Survey URL</field>
<field name="model">survey.setting</field>
<field name="arch" type="xml">
<tree>
<field name="survey_url"/>
</tree>
</field>
</record>
<record id="suspend_reason_form" model="ir.ui.view">
<field name="name">Suspend Reason</field>
<field name="model">suspend.reason</field>
<record id="survey_setting_form" model="ir.ui.view">
<field name="name">Survey URL</field>
<field name="model">survey.setting</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="survey_url"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="survey_setting_tree" model="ir.ui.view">
<field name="name">Survey URL</field>
<field name="model">survey.setting</field>
<field name="arch" type="xml">
<tree>
<field name="survey_url"/>
</tree>
</field>
</record>
<record id="suspend_reason_form" model="ir.ui.view">
<field name="name">Reasons of Suspension and Refusal</field>
<field name="model">suspend.reason</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group>
<field name="is_stop_reason" widget="boolean_toggle"/>
<field name="is_reject_reason" widget="boolean_toggle"/>
<field name="is_return_reason" widget="boolean_toggle"/>
</group>
<group>
<field name="is_family_return_reason" widget="boolean_toggle"/>
<field name="is_incomplete_visit_reason" widget="boolean_toggle"/>
</group>
</group>
</sheet>
@ -940,11 +953,16 @@
</field>
</record>
<record id="suspend_reason_tree" model="ir.ui.view">
<field name="name">Suspend Reason</field>
<field name="name">Reasons of Suspension and Refusal</field>
<field name="model">suspend.reason</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="is_stop_reason" widget="boolean_toggle"/>
<field name="is_reject_reason" widget="boolean_toggle"/>
<field name="is_return_reason" widget="boolean_toggle"/>
<field name="is_family_return_reason" widget="boolean_toggle"/>
<field name="is_incomplete_visit_reason" widget="boolean_toggle"/>
</tree>
</field>
</record>
@ -964,7 +982,7 @@
</form>
</field>
</record>
<record id="branch_settings_tree" model="ir.ui.view">
<record id="branch_settings_tree" model="ir.ui.view">
<field name="name">Branch Settings</field>
<field name="model">branch.settings</field>
<field name="arch" type="xml">
@ -974,7 +992,7 @@
</tree>
</field>
</record>
<record id="relation_settings_form" model="ir.ui.view">
<record id="relation_settings_form" model="ir.ui.view">
<field name="name">Relation Settings</field>
<field name="model">relation.settings</field>
<field name="arch" type="xml">
@ -1000,7 +1018,7 @@
</tree>
</field>
</record>
<record id="location_settings_form" model="ir.ui.view">
<record id="location_settings_form" model="ir.ui.view">
<field name="name">Location Settings</field>
<field name="model">location.settings</field>
<field name="arch" type="xml">
@ -1011,7 +1029,7 @@
<field name="name"/>
<field name="location_type"/>
<field name="is_benefit"/>
<field name="is_far_from_family" />
<field name="is_far_from_family"/>
</group>
</group>
</sheet>
@ -1023,10 +1041,10 @@
<field name="model">location.settings</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="name"/>
<field name="location_type"/>
<field name="is_benefit"/>
<field name="is_far_from_family" />
<field name="is_far_from_family"/>
</tree>
</field>
</record>
@ -1040,12 +1058,15 @@
<group>
<field name="name"/>
<field name="attach_type"/>
<field name="family_appearance_seq" attrs="{'invisible':[('attach_type','!=','family_attach')]}"/>
<field name="member_appearance_seq" attrs="{'invisible':[('attach_type','!=','member_attach')]}"/>
<field name="income_appearance_seq" attrs="{'invisible':[('attach_type','!=','income_attach')]}"/>
<!-- <field name="hobby_id"/>-->
<!-- <field name="diseases_id"/>-->
<!-- <field name="disabilities_id"/>-->
<field name="family_appearance_seq"
attrs="{'invisible':[('attach_type','!=','family_attach')]}"/>
<field name="member_appearance_seq"
attrs="{'invisible':[('attach_type','!=','member_attach')]}"/>
<field name="income_appearance_seq"
attrs="{'invisible':[('attach_type','!=','income_attach')]}"/>
<!-- <field name="hobby_id"/>-->
<!-- <field name="diseases_id"/>-->
<!-- <field name="disabilities_id"/>-->
<field name="is_mother_salary"/>
<field name="is_required"/>
<field name="is_default"/>
@ -1069,7 +1090,7 @@
</tree>
</field>
</record>
<record id="education_illiterate_reason_form" model="ir.ui.view">
<record id="education_illiterate_reason_form" model="ir.ui.view">
<field name="name">Education Illiterate Reason</field>
<field name="model">education.illiterate.reason</field>
<field name="arch" type="xml">
@ -1093,8 +1114,8 @@
</tree>
</field>
</record>
<!-- Income Type Form and Tree -->
<record id="income_type_form" model="ir.ui.view">
<!-- Income Type Form and Tree -->
<record id="income_type_form" model="ir.ui.view">
<field name="name">Income Type</field>
<field name="model">income.type</field>
<field name="arch" type="xml">
@ -1109,7 +1130,7 @@
</form>
</field>
</record>
<record id="income_type_tree" model="ir.ui.view">
<record id="income_type_tree" model="ir.ui.view">
<field name="name">Income Type Tree</field>
<field name="model">income.type</field>
<field name="arch" type="xml">
@ -1118,8 +1139,8 @@
</tree>
</field>
</record>
<!-- Expenses Type Form and Tree -->
<record id="expenses_type_form" model="ir.ui.view">
<!-- Expenses Type Form and Tree -->
<record id="expenses_type_form" model="ir.ui.view">
<field name="name">Expenses Type</field>
<field name="model">expenses.type</field>
<field name="arch" type="xml">
@ -1134,7 +1155,7 @@
</form>
</field>
</record>
<record id="expenses_type_tree" model="ir.ui.view">
<record id="expenses_type_tree" model="ir.ui.view">
<field name="name">Expenses Type Tree</field>
<field name="model">expenses.type</field>
<field name="arch" type="xml">
@ -1143,8 +1164,8 @@
</tree>
</field>
</record>
<!-- Loan Giver FOrm AND tree -->
<record id="loan_giver_form" model="ir.ui.view">
<!-- Loan Giver FOrm AND tree -->
<record id="loan_giver_form" model="ir.ui.view">
<field name="name">Loan Giver Form</field>
<field name="model">loan.giver</field>
<field name="arch" type="xml">
@ -1159,7 +1180,7 @@
</form>
</field>
</record>
<record id="loan_giver_tree" model="ir.ui.view">
<record id="loan_giver_tree" model="ir.ui.view">
<field name="name">Loan Giver Tree</field>
<field name="model">loan.giver</field>
<field name="arch" type="xml">
@ -1169,7 +1190,7 @@
</field>
</record>
<!-- Hobbies Settings Form AND tree -->
<record id="hobbies_settings_form" model="ir.ui.view">
<record id="hobbies_settings_form" model="ir.ui.view">
<field name="name">Hobbies Settings Form</field>
<field name="model">hobbies.settings</field>
<field name="arch" type="xml">
@ -1193,8 +1214,8 @@
</tree>
</field>
</record>
<!-- Disabilities Setting Form AND tree -->
<record id="disabilities_settings_form" model="ir.ui.view">
<!-- Disabilities Setting Form AND tree -->
<record id="disabilities_settings_form" model="ir.ui.view">
<field name="name">Disabilities Settings Form</field>
<field name="model">disabilities.settings</field>
<field name="arch" type="xml">
@ -1209,7 +1230,7 @@
</form>
</field>
</record>
<record id="disabilities_settings_tree" model="ir.ui.view">
<record id="disabilities_settings_tree" model="ir.ui.view">
<field name="name">Disabilities Settings Tree</field>
<field name="model">disabilities.settings</field>
<field name="arch" type="xml">
@ -1218,8 +1239,8 @@
</tree>
</field>
</record>
<!-- Diseases Settings Form AND tree -->
<record id="diseases_settings_form" model="ir.ui.view">
<!-- Diseases Settings Form AND tree -->
<record id="diseases_settings_form" model="ir.ui.view">
<field name="name">Diseases Settings Form</field>
<field name="model">diseases.settings</field>
<field name="arch" type="xml">
@ -1234,7 +1255,7 @@
</form>
</field>
</record>
<record id="diseases_settings_tree" model="ir.ui.view">
<record id="diseases_settings_tree" model="ir.ui.view">
<field name="name">Diseases Settings Tree</field>
<field name="model">diseases.settings</field>
<field name="arch" type="xml">
@ -1243,8 +1264,8 @@
</tree>
</field>
</record>
<!-- Exception Reason Form AND tree -->
<record id="exception_reason_form" model="ir.ui.view">
<!-- Exception Reason Form AND tree -->
<record id="exception_reason_form" model="ir.ui.view">
<field name="name">Exception Reason Form</field>
<field name="model">exception.reason</field>
<field name="arch" type="xml">
@ -1259,7 +1280,7 @@
</form>
</field>
</record>
<record id="exception_reason_tree" model="ir.ui.view">
<record id="exception_reason_tree" model="ir.ui.view">
<field name="name">Exception Reason Tree</field>
<field name="model">exception.reason</field>
<field name="arch" type="xml">
@ -1268,8 +1289,8 @@
</tree>
</field>
</record>
<!-- Marital Status Form AND tree -->
<record id="marital_status_form" model="ir.ui.view">
<!-- Marital Status Form AND tree -->
<record id="marital_status_form" model="ir.ui.view">
<field name="name">Marital Status Form</field>
<field name="model">marital.status</field>
<field name="arch" type="xml">
@ -1286,7 +1307,7 @@
</form>
</field>
</record>
<record id="marital_status_tree" model="ir.ui.view">
<record id="marital_status_tree" model="ir.ui.view">
<field name="name">Marital Status Tree</field>
<field name="model">marital.status</field>
<field name="arch" type="xml">
@ -1296,8 +1317,8 @@
</tree>
</field>
</record>
<!-- Age Category Form AND tree -->
<record id="age_category_form" model="ir.ui.view">
<!-- Age Category Form AND tree -->
<record id="age_category_form" model="ir.ui.view">
<field name="name">Age Category Form</field>
<field name="model">age.category</field>
<field name="arch" type="xml">
@ -1315,7 +1336,7 @@
</form>
</field>
</record>
<record id="age_category_tree" model="ir.ui.view">
<record id="age_category_tree" model="ir.ui.view">
<field name="name">Age Category Tree</field>
<field name="model">age.category</field>
<field name="arch" type="xml">
@ -1326,39 +1347,39 @@
</tree>
</field>
</record>
<!-- Complaints Category Form AND tree -->
<record id="complaints_category_form" model="ir.ui.view">
<!-- Complaints Category Form AND tree -->
<record id="complaints_category_form" model="ir.ui.view">
<field name="name">Complaints Category Form</field>
<field name="model">complaints.category</field>
<field name="arch" type="xml">
<form string="Complaints Category">
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
<sheet>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name"/>
</div>
<h1>
<field name="name"/>
</h1>
</div>
<h1>
<field name="name"/>
</h1>
</div>
<group>
<group>
<field name="color" required="True"/>
<group>
<field name="color" required="True"/>
</group>
</group>
</group>
</sheet>
</form>
</sheet>
</form>
</field>
</record>
<record id="age_category_tree" model="ir.ui.view">
<record id="age_category_tree" model="ir.ui.view">
<field name="name">Complaints Category Tree</field>
<field name="model">complaints.category</field>
<field name="arch" type="xml">
<tree string="Complaints Category" editable="bottom">
<field name="name"/>
<field name="color" widget="color_picker" />
</tree>
</field>
<tree string="Complaints Category" editable="bottom">
<field name="name"/>
<field name="color" widget="color_picker"/>
</tree>
</field>
</record>
</data>
</odoo>

View File

@ -213,6 +213,10 @@
<field name="state" widget="statusbar"
statusbar_visible="draft,new,complete_info,waiting_approve,first_approve,second_approve"/>
</header>
<!-- <div class="alert alert-danger" role="alert" style="margin-bottom:0px;"-->
<!-- attrs="{'invisible':['|',('status', 'not in', ('close')),('close_reason', '=', False)]}">-->
<!-- <field name="close_reason" attrs="{'readonly': True}"/>-->
<!-- </div>-->
<sheet>
<div class="oe_button_box" name="button_box"
attrs="{'invisible':[('state','in',['draft','new'])]}">
@ -312,8 +316,6 @@
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="member_income" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
<field name="total_income" widget="monetary"
options="{'currency_field': 'currency_id'}" invisible="1"/>
<field name="benefit_category_id" readonly="1" force_save="1"/>
<field name="mother_family_member_id" invisible="1" readonly="1"/>
<field name="replacement_mother_family_member_id" invisible="1" readonly="1"/>
@ -481,26 +483,26 @@
options="{'no_create': True, 'no_create_edit': True,'no_quick_create': True, 'no_open': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="mother_is_dead" invisible="1"/>
<field name="mother_dead_reason_id_not_defined" invisible="1" />
<field name="mother_dead_reason_id_not_defined" invisible="1"/>
<field name="mother_dead_reason_id" attrs="{
'invisible': [('mother_is_dead', '=', False)],
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]}" />
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]}"/>
<field name="mother_dead_reason" attrs="{
'invisible': ['|', ('mother_dead_reason_id_not_defined', '=', False), ('mother_is_dead', '=', False)],
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]
}" />
}"/>
<!-- <field name="mother_dead_reason" attrs="{
'invisible': [('mother_dead_reason_id_not_defined', '=', False)],
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]
}" /> -->
<field name="mother_dead_country_id"
attrs="{'invisible':[('mother_is_dead','=',False)],'required':[('mother_is_dead','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="mother_dead_res_city_id_not_defined" invisible="1" />
<field name="mother_dead_country_id_code" invisible="1" />
<field name="mother_dead_res_city_id_not_defined" invisible="1"/>
<field name="mother_dead_country_id_code" invisible="1"/>
<field name="mother_dead_res_city_id" attrs="{
'invisible':['|', ('mother_is_dead', '=', False), ('mother_dead_country_id_code', '!=', 'SA')],
'required':[('mother_dead_country_id_code', '=', 'SA'), ('mother_is_dead','=',True)],
'readonly':[('state','not in',['draft','new','complete_info'])]}" />
'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="mother_dead_city" attrs="{
'invisible': [
'|',
@ -534,12 +536,13 @@
options="{'currency_field': 'currency_id', 'field_digits': False}"
digits="[16,0]"
attrs="{'required':[('is_mother_work','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="education_status" />
<field name="education_status"/>
<!-- <field name="is_mother_benefit"/>-->
</group>
</group>
<notebook>
<page string="Education Status" attrs="{'invisible': [('education_status', '!=', 'educated')]}">
<page string="Education Status"
attrs="{'invisible': [('education_status', '!=', 'educated')]}">
<field name="mother_education_status_ids" mode="tree,form"/>
</page>
<page string="Diseases">
@ -632,12 +635,13 @@
options="{'no_create': True, 'no_create_edit': True,'no_quick_create': True, 'no_open': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="replacement_mother_is_dead" invisible="1"/>
<field name="replacement_dead_reason_id_not_defined" invisible="1" />
<field name="replacement_dead_reason_id" attrs="{'invisible': [('replacement_mother_is_dead', '=', False)]}" />
<field name="replacement_dead_reason_id_not_defined" invisible="1"/>
<field name="replacement_dead_reason_id"
attrs="{'invisible': [('replacement_mother_is_dead', '=', False)]}"/>
<field name="replacement_dead_reason" attrs="{
'invisible': ['|', ('replacement_dead_reason_id_not_defined', '=', False), ('replacement_mother_is_dead', '=', False)],
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]
}" />
}"/>
<!-- <field name="replacement_dead_reason" attrs="{
'invisible': [('replacement_dead_reason_id_not_defined', '=', False)],
'readonly': [('state', 'not in', ['draft', 'new', 'complete_info'])]
@ -646,8 +650,8 @@
attrs="{'invisible':[('replacement_mother_is_dead','=',False)],'required':[('replacement_mother_is_dead','=',True),('add_replacement_mother','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"
options="{'no_create': True, 'no_create_edit': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="replacement_dead_country_id_code" invisible="1" />
<field name="replacement_dead_res_city_id_not_defined" invisible="1" />
<field name="replacement_dead_country_id_code" invisible="1"/>
<field name="replacement_dead_res_city_id_not_defined" invisible="1"/>
<field name="replacement_mother_dead_city_id" attrs="{
'invisible':['|', ('replacement_mother_is_dead','=',False), ('replacement_dead_country_id_code', '!=', 'SA')],
'required':[('replacement_dead_country_id_code', '=', 'SA'), ('replacement_mother_is_dead','=',True),('add_replacement_mother','=',True)],
@ -669,7 +673,7 @@
('replacement_dead_res_city_id_not_defined', '=', False)
],
'required':[('replacement_mother_is_dead','=',True),('add_replacement_mother','=',True)],
'readonly':[('state','not in',['draft','new','complete_info'])]}" />
'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="replacement_mother_dead_date"
attrs="{'invisible':[('replacement_mother_is_dead','=',False)],'required':[('replacement_mother_is_dead','=',True),('add_replacement_mother','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="replacement_mother_dead_certificate"
@ -691,12 +695,13 @@
attrs="{'required':[('state','not in',['draft','new']),('add_replacement_mother','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="replacement_mother_income"
attrs="{'required':[('replacement_is_mother_work','=',True),('add_replacement_mother','=',True)],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="replacement_education_status" />
<field name="replacement_education_status"/>
<!-- <field name="is_mother_benefit"/>-->
</group>
</group>
<notebook>
<page string="Education Status" attrs="{'invisible': [('replacement_education_status', '!=', 'educated')]}">
<page string="Education Status"
attrs="{'invisible': [('replacement_education_status', '!=', 'educated')]}">
<field name="replacement_education_status_ids" mode="tree,form"/>
</page>
<page string="Diseases">
@ -826,7 +831,7 @@
attrs="{'invisible':[('is_mother','=',False)]}"
options="{'no_create': True, 'no_create_edit': True}"
groups="!odex_benefit.group_benefit_manager"/>
<field name="education_status" />
<field name="education_status"/>
</group>
<group>
<field name="is_work" attrs="{'invisible':[('age','&lt;',18)]}"/>
@ -902,7 +907,8 @@
</tree>
</field>
</page>
<page string="Education Status" attrs="{'invisible': [('education_status', '!=', 'educated')]}">
<page string="Education Status"
attrs="{'invisible': [('education_status', '!=', 'educated')]}">
<field name="member_education_status_ids" mode="tree,form"/>
</page>
<page string="Attachments">
@ -1184,6 +1190,8 @@
<field name="approved" widget="boolean_toggle"/>
</tree>
</field>
<field name="total_income" widget="monetary"
options="{'currency_field': 'currency_id'}" invisible="0"/>
<group>
<field name="income_required_attach" invisible="1"/>
</group>

View File

@ -17,7 +17,8 @@ class EntityRefusedReasonWizard(models.TransientModel):
return self._context.get('state')
entity_id = fields.Many2one("grant.benefit", string="Benefit", default=_default_entity)
refused_reason = fields.Text(string='Refused Reason', required=True)
refused_reason = fields.Text(string='Notes', required=True)
suspend_reason_id = fields.Many2one("suspend.reason", string="Refused Reason",domain=[('is_reject_reason', '=', True)])
state = fields.Selection([
('draft', 'Draft'),
('first_refusal', 'First Refusal'),
@ -44,50 +45,21 @@ class EntityRefusedReasonWizard(models.TransientModel):
state = "first_refusal"
subject = _('Benefit')
state_label = dict(rec.fields_get(allfields=['state'])['state']['selection'])[state]
body = ' '.join(
(_(u'The Benefit '), rec.entity_id.name, _(u' State changed to '), state_label, u'.')).encode(
'utf-8')
body = _(
"The Benefit <b>%s</b> state changed to <b>%s</b>.<br/>"
"Suspend Reason: <b>%s</b><br/>"
"Notes: <b>%s</b>"
) % (rec.entity_id.name,state_label,rec.suspend_reason_id.name if rec.suspend_reason_id else '',rec.refused_reason)
partner_ids += [(6, 0, rec.entity_id.message_follower_ids.ids)]
message_vals = {
'subject': subject,
'body': body,
'partner_ids': partner_ids,
}
now = fields.datetime.now()
first_refuse_date = datetime.strftime(now, '%Y-%m-%d')
rec.entity_id.message_post(body=body, subject=subject, message_type='email')
result = rec.entity_id.sudo().write({
rec.entity_id.sudo().write({
"state": 'first_refusal',
"first_refusal_reason": rec.refused_reason,
"first_refuse_date": first_refuse_date,
"family_return_reason": rec.suspend_reason_id.name
})
# elif rec.entity_id.state == "first_refusal":
# self.env['entity.refuse_reason'].sudo().create(
# {
# 'name': 'first_refusal',
# 'entity_id': rec.entity_id.id,
# 'user_id': self.env.uid
# }
# )
# subject = _('Benefit')
# state_label = dict(rec.fields_get(allfields=['state'])['state']['selection'])[rec.entity_id.state]
# body = ' '.join(
# (_(u'The Benefit '), rec.entity_id.name, _(u' State changed to '), state_label, u'.')).encode(
# 'utf-8')
# partner_ids += [(6, 0, rec.entity_id.message_follower_ids.ids)]
# partner_ids += [(6, 0, rec.entity_id.partner_id.id)]
#
# message_vals = {
# 'subject': subject,
# 'body': body,
# 'partner_ids': partner_ids,
# }
# rec.entity_id.message_post(body=body, subject=subject, message_type='email')
# result = rec.entity_id.sudo().write({
# "state": rec.entity_id.state,
# "first_refusal_reason": rec.refused_reason,
# # "end_subscribe_date": rec.end_subscribe_date,
# })
return {'type': 'ir.actions.act_window_close'}
# @api.multi
@ -138,10 +110,8 @@ class EntityRefusedReasonWizard(models.TransientModel):
# 'target': 'main',
# }
#
class EntityReturnReasonWizard(models.TransientModel):
_name = 'entity.return.reason.wizard'
_description = "Return Reason Wizard"
def _default_entity(self):
@ -151,7 +121,8 @@ class EntityReturnReasonWizard(models.TransientModel):
return self._context.get('target_state', 'complete_info')
entity_id = fields.Many2one("grant.benefit", string="Benefit", default=_default_entity)
return_reason = fields.Text(string='Return Reason', required=True)
suspend_reason_id = fields.Many2one("suspend.reason", string="Return Reason", required=True)
return_reason = fields.Text(string='Notes', required=True)
target_state = fields.Char(string='Target State', default=_get_target_state)
def action_confirm_return(self):
@ -164,8 +135,8 @@ class EntityReturnReasonWizard(models.TransientModel):
subject = _('Benefit')
body = _(
"The benefit record <b>%s</b> state has been changed to <b>%s</b>.<br/>"
"Return Reason: <b>%s</b>"
) % (rec.entity_id.name, state_label, rec.return_reason)
"Return Reason: <b>%s</b><br/>"
"Notes: <b>%s</b>") % (rec.entity_id.name,state_label,rec.suspend_reason_id.name or '',rec.return_reason or '')
rec.entity_id.message_post(
body=body,
@ -173,10 +144,19 @@ class EntityReturnReasonWizard(models.TransientModel):
message_type='notification'
)
rec.entity_id.sudo().write({"state": target_state})
rec.entity_id.sudo().write({"state": target_state,"family_return_reason": rec.suspend_reason_id.name})
if rec.entity_id.state == 'draft':
rec.entity_id.sudo().write({"family_edit": True})
message = rec.entity_id.create_message(target_state)
rec.entity_id.user_id.send_sms_to_user(message, rec.entity_id.sms_phone)
return {'type': 'ir.actions.act_window_close'}
return {'type': 'ir.actions.act_window_close'}
@api.onchange('target_state')
def _onchange_target_state(self):
domain = []
if self.target_state == "draft":
domain = [('is_family_return_reason', '=', True)]
elif self.target_state == "complete_info":
domain = [('is_return_reason', '=', True)]
return {'domain': {'suspend_reason_id': domain}}

View File

@ -10,6 +10,7 @@
<sheet>
<group>
<field name="entity_id" invisible="1"/>
<field name="suspend_reason_id" required="1"/>
<field name="refused_reason"/>
</group>
@ -53,9 +54,12 @@
<sheet>
<group>
<field name="entity_id" invisible="1"/>
<field name="return_reason"/>
<field name="suspend_reason_id"/>
</group>
<group>
<field name="target_state" invisible="1"/>
<field name="return_reason" no_label="1"/>
</group>
<footer>
<button name="action_confirm_return" type="object" string="Retrun" class="oe_highlight"/>
or