Merge pull request #5788 from expsa/kch_dev_odex25_benefit

Kch dev odex25 benefit
This commit is contained in:
kchyounes19 2025-12-22 13:47:34 +01:00 committed by GitHub
commit 511c95306c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 177 additions and 40 deletions

View File

@ -75,7 +75,6 @@
- **معلومات السكن:**
- `housing_type`: نوع السكن (apartment/villa/popular_house/tent)
- `property_type`: نوع الملكية (ownership/rent/charitable/ownership_shared/rent_shared)
- `rent_amount`: مبلغ الإيجار
- `contract_num`: رقم عقد الإيجار
- `rent_start_date`: تاريخ بداية الإيجار

View File

@ -1139,6 +1139,7 @@ msgstr "نموذج الأنشطة"
#: model:ir.model.fields,field_description:odex_benefit.field_external_benefits__active
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__active
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__active
#: model:ir.model.fields,field_description:odex_benefit.field_property_type_settings__active
#: model:ir.model.fields,field_description:odex_benefit.field_visits_types__active
#: model:ir.model.fields,field_description:odex_benefit.field_return_reason__active
msgid "Active"
@ -8410,6 +8411,7 @@ msgstr "نهاية الوقت المعين للنشاط"
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_benefit_housing_form
#: model_terms:ir.ui.view,arch_db:odex_benefit.benefit_vehicle_model_form_view
#: model:ir.model.fields,field_description:odex_benefit.field_education_exam_type__name
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_property_type_settings_form
#: model:ir.model.fields,field_description:odex_benefit.field_education_period__name
msgid "Name"
msgstr "الاسم"
@ -9029,7 +9031,6 @@ msgstr "زيادة الوزن"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_housing__property_type__ownership_shared
#: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__property_type__ownership_shared
msgid "Ownership Shared"
msgstr "سكن مشترك ملك"
@ -9391,6 +9392,8 @@ msgstr "رقم الصك"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_benefit_housing__property_type
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__property_type
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__property_type_id
#: model:ir.model.fields,field_description:odex_benefit.field_property_type_settings__type
msgid "Property Type"
msgstr "نوع العقار"
@ -9811,6 +9814,11 @@ msgstr "اسم دروس التقوية"
msgid "Rent"
msgstr "إيجار المنزل"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__property_type_settings__type__rent
msgid "Rent"
msgstr "إيجار"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_benefit_housing__rent_amount
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__rent_amount
@ -9875,7 +9883,6 @@ msgstr ""
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_housing__property_type__rent_shared
#: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__property_type__rent_shared
msgid "Rent Shared"
msgstr "سكن مشترك إيجار"
@ -12617,7 +12624,6 @@ msgstr "طلبات النقل"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_housing__property_type__charitable
#: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__property_type__charitable
msgid "charitable"
msgstr "وقف خيري"
@ -13361,10 +13367,14 @@ msgstr ""
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_housing__property_type__ownership
#: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__property_type__ownership
msgid "ownership"
msgstr "ملك"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__property_type_settings__type__ownership
msgid "Ownership"
msgstr "ملك"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_benefit_expenses__pandemics_explain
msgid "pandemics explain"
@ -13497,7 +13507,6 @@ msgstr "مرفوض"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_housing__property_type__rent
#: model:ir.model.fields.selection,name:odex_benefit.selection__grant_benefit__property_type__rent
msgid "rent"
msgstr "إيجار"
@ -17905,3 +17914,37 @@ msgstr "تم الشراء من قبل الجمعية؟"
msgid "Indicates whether the car was purchased by the association"
msgstr "يشير إلى ما إذا تم شراء السيارة من قبل الجمعية"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__property_type_code
msgid "Property Type Code"
msgstr "نوع العقار"
#. module: odex_benefit
#: model:ir.actions.act_window,name:odex_benefit.action_property_type_settings
#: model:ir.model,name:odex_benefit.model_property_type_settings
#: model:ir.ui.menu,name:odex_benefit.menu_property_type_settings
msgid "Property Type Settings"
msgstr "إعداد أنواع العقار"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_property_type_settings__is_shared
msgid "Shared"
msgstr "مشترك"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_property_type_settings__unavailable_service_ids
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_property_type_settings_form
msgid "Unavailable Services"
msgstr "الخدمات غير المتاحة"
#. module: odex_benefit
#: model:ir.model.fields,help:odex_benefit.field_property_type_settings__unavailable_service_ids
msgid ""
"Services that are not available for families or members with this property "
"type"
msgstr "الخدمات غير المتاحة للأسر أو الأفراد الذين لديهم هذا النوع من العقار"
#. module: odex_benefit
#: model_terms:ir.actions.act_window,help:odex_benefit.action_property_type_settings
msgid "Create the Property Type"
msgstr "إنشاء نوع العقار"

View File

@ -478,6 +478,11 @@ class GrantBenefitProfile(models.Model):
('charitable', 'charitable'),
('ownership_shared', 'Ownership Shared'),
('rent_shared', 'Rent Shared')])
property_type_id = fields.Many2one('property.type.settings',string="Property Type",tracking=True)
property_type_code = fields.Selection([
('ownership', 'Ownership'),
('rent', 'Rent')
], string="Property Type Code",related='property_type_id.type', store=True)
room_ids = fields.One2many('benefit.housing.rooms', inverse_name='housing_id')
request_producer_id = fields.Many2one('res.partner',string='Request Producer', compute='_compute_request_producer_id')
request_producer = fields.Many2one('res.partner',string='Request Producer',default=lambda self: self.env.user.partner_id)
@ -747,11 +752,11 @@ class GrantBenefitProfile(models.Model):
"You can only archive the family if its status is: Refused, Final Suspension, or Blacklisted."
))
@api.depends('rent_amount','property_type','benefit_member_count', 'branch_custom_id.branch_type')
@api.depends('rent_amount','property_type_id','benefit_member_count', 'branch_custom_id.branch_type')
def _compute_estimated_rent_amount(self):
for rec in self:
estimated_rent_amount = 0.0
if rec.rent_amount > 0 and rec.property_type in ['rent','rent_shared']:
if rec.rent_amount > 0 and rec.property_type_id and rec.property_type_code == 'rent':
if rec.branch_custom_id.branch_type == 'branches':
estimated_rent_amount = self.env['rent.lines'].search(
[('benefit_count', '=', rec.benefit_member_count)], order="estimated_rent_branches desc",limit=1).estimated_rent_branches

View File

@ -937,3 +937,21 @@ class HomeFurnishingItems(models.Model):
price_second = fields.Float(string='Price Second')
price_second_attach = fields.Many2many('ir.attachment','rel_second_price_attachments', 'furnishing_id', 'attach_id',string="Second Price Attachment")
service_request_id = fields.Many2one('service.request',string='Service Request')
class PropertyTypeSettings(models.Model):
_name = 'property.type.settings'
_description = 'Property Type Settings'
_order = 'name'
name = fields.Char(string="Name", required=True)
type = fields.Selection([
('ownership', 'Ownership'),
('rent', 'Rent')
], string="Property Type", required=True)
is_shared = fields.Boolean(string="Shared", default=False)
active = fields.Boolean(string="Active", default=True)
unavailable_service_ids = fields.Many2many(
'services.settings',
string="Unavailable Services",
help="Services that are not available for families or members with this property type"
)

View File

@ -713,8 +713,7 @@ class ServiceRequest(models.Model):
@api.onchange('service_cat', 'family_id')
def _onchange_service_cat(self):
if self.service_cat.service_type == 'rent' and self.family_id.property_type not in ['rent',
'rent_shared'] and self.benefit_type == 'family':
if self.service_cat.service_type == 'rent' and self.family_id.property_type_code == 'rent' and self.benefit_type == 'family':
raise UserError(_("You cannot benefit from this service (property type not rent)"))
@api.onchange('start', 'end', 'rent_start_date', 'rent_end_date', 'payment_type')
@ -1091,10 +1090,17 @@ class ServiceRequest(models.Model):
for rec in self:
domain = [('is_seasonal_service', '=', False), ('service_type', '!=', 'main_service'),
('benefit_category_ids', 'in', [rec.family_category.id])]
if rec.family_id.property_type not in ['ownership', 'ownership_shared', 'charitable']:
if rec.family_id.property_type_id:
if rec.family_id.property_type_code != 'ownership':
domain.append(('service_type', '!=', 'home_restoration'))
else:
domain.append(('service_type', '!=', 'buy_home'))
unavailable_services = rec.family_id.property_type_id.unavailable_service_ids
if unavailable_services:
domain.append(('id', 'not in', unavailable_services.ids))
rec.available_service_cats = rec.available_service_cats.sudo().search(domain)
def action_set_to_draft(self):
@ -1233,7 +1239,11 @@ class ServiceRequest(models.Model):
# Determine rent amount based on branch type and property type
branch_type = rec.family_id.branch_family_id.branch_type
is_shared_rent = rec.family_id.property_type == 'rent_shared'
is_shared_rent = (
rec.family_id.property_type_id and
rec.family_id.property_type_id.type == 'rent' and
rec.family_id.property_type_id.is_shared
)
if branch_type == 'branches':
rec.estimated_rent_amount = item.estimated_rent_branches * (
@ -1249,7 +1259,11 @@ class ServiceRequest(models.Model):
# Determine rent amount based on branch type and property type
branch_type = rec.family_id.branch_custom_id.branch_type
is_shared_rent = rec.family_id.property_type == 'rent_shared'
is_shared_rent = (
rec.family_id.property_type_id and
rec.family_id.property_type_id.type == 'rent' and
rec.family_id.property_type_id.is_shared
)
if branch_type == 'branches':
rec.estimated_rent_amount = item.estimated_rent_branches * (

View File

@ -172,3 +172,4 @@ access_expense_researcher,access_expense_researcher,model_benefit_expense_line,o
access_family_bank_report_wizard,access_family_bank_report_wizard,model_family_bank_report_wizard,base.group_user,1,1,1,1
access_return_reason,access_return_reason,model_return_reason,base.group_user,1,1,1,1
access_return_reason_wizard,access_return_reason_wizard,model_return_reason_wizard,base.group_user,1,1,1,1
access_property_type_settings,access_property_type_settings,model_property_type_settings,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
172 access_family_bank_report_wizard access_family_bank_report_wizard model_family_bank_report_wizard base.group_user 1 1 1 1
173 access_return_reason access_return_reason model_return_reason base.group_user 1 1 1 1
174 access_return_reason_wizard access_return_reason_wizard model_return_reason_wizard base.group_user 1 1 1 1
175 access_property_type_settings access_property_type_settings model_property_type_settings base.group_user 1 1 1 1

View File

@ -760,6 +760,15 @@
<field name="domain">[('is_supporter','=', True)]</field>
<field name="context">{'default_is_company':True,'default_is_supporter':True}</field>
</record>
<record id="action_property_type_settings" model="ir.actions.act_window">
<field name="name">Property Type Settings</field>
<field name="res_model">property.type.settings</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the Property Type
</p>
</field>
</record>
<!--###########################################################-->
<!--Benefit Menus-->
@ -901,12 +910,19 @@
action="member_location_action"
sequence="10"
/>
<menuitem
id="menu_property_type_settings"
name="Property Type Settings"
parent="benefit_tools"
action="action_property_type_settings"
sequence="11"
/>
<menuitem
id="family_validation_location"
name="Family Validation Setting"
parent="benefit_tools"
action="family_validation_action"
sequence="11"
sequence="12"
/>
<menuitem id="benefit_category_menu" name="category" parent="menu_benefits_config_organizing"
action="category_action"
@ -988,7 +1004,7 @@
id="menu_benefits_config_benefits"
name="benefits"
parent="benefit_tools"
sequence="5"/>
sequence="6"/>
<menuitem id="res_bank_menu" name="Banks" parent="menu_benefits_config_benefits" action="res_bank_list_action"
sequence="1"/>
<!-- <menuitem id="hospital_menu" name="Hospital" parent="menu_benefits_config_benefits" action="hospital_action"-->
@ -1011,7 +1027,7 @@
id="menu_benefits_config_contact"
name="contact"
parent="benefit_tools"
sequence="5"/>
sequence="7"/>
<menuitem id="sms_config_menu" name="SMS Template" sequence="12"
parent="menu_benefits_config_contact" action="benefit_sms_configuration_action"/>
<menuitem id="email_menu" name="Email Template" sequence="13"
@ -1020,7 +1036,7 @@
id="menu_benefits_config_others"
name="others"
parent="benefit_tools"
sequence="6"
sequence="8"
/>
<!-- <menuitem id="main_service_menu" name="Service Types" parent="benefit_tools"-->
<!-- action="main_service_action" sequence="7"/>-->

View File

@ -1457,5 +1457,45 @@
</tree>
</field>
</record>
<record id="view_property_type_settings_tree" model="ir.ui.view">
<field name="name">property.type.settings.tree</field>
<field name="model">property.type.settings</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="type"/>
<field name="is_shared"/>
<field name="unavailable_service_ids" widget="many2many_tags"/>
</tree>
</field>
</record>
<record id="view_property_type_settings_form" model="ir.ui.view">
<field name="name">property.type.settings.form</field>
<field name="model">property.type.settings</field>
<field name="arch" type="xml">
<form>
<sheet>
<div class="oe_title">
<h1>
<field placeholder="Name" name="name" class="oe_inline"/>
</h1>
</div>
<group>
<group>
<field name="type"/>
</group>
<group>
<field name="is_shared" widget="boolean_toggle"/>
</group>
</group>
<notebook>
<page string="Unavailable Services">
<field name="unavailable_service_ids"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
</data>
</odoo>

View File

@ -59,7 +59,7 @@
<field name="branch_custom_id"/>
<field name="last_visit_date"/>
<field name="currency_id"/>
<field name="property_type"/>
<field name="property_type_id"/>
<field name="total_service_requests"/>
<field name="city_id"/>
<field name="non_member_count"/>
@ -454,7 +454,7 @@
attrs="{'invisible': [('state', '!=', 'temporary_suspended')]}"
groups="odex_benefit.group_benefit_manager"/>
<button name="action_reject_resume" type="object"
string="Reject Resume" class="oe_highlight"
string="Reject Resume" class="btn btn-danger"
attrs="{'invisible': ['|',('action_type','not in',['resume_from_final','resume_from_temporary']),('state', 'not in', ['waiting_approve','first_approve','family_services_manager'])]}"
/>
<button name="action_suspend_refuse" type="object"
@ -1420,30 +1420,31 @@
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="housing_cat"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="property_type"
<field name="property_type_code" invisible="1"/>
<field name="property_type_id" options="{'no_create': True, 'no_create_edit': True,'no_quick_create': True, 'no_open': True}"
attrs="{'required':[('state','not in',['draft','new'])],'readonly':[('state','not in',['draft','new','complete_info'])]}"/>
<field name="payment_type"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"/>
<field name="rent_amount"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"/>
<field name="contract_num"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"/>
<field name="rent_start_date"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"/>
<field name="rent_end_date"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"/>
<field name="rent_attachment"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','rent')]}"
widget="many2many_attachment_preview"/>
<field name="property_instrument_number"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','ownership'),('property_type','!=','charitable'),('property_type','!=','ownership_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','ownership')]}"/>
<field name="property_instrument_attach"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','ownership'),('property_type','!=','charitable'),('property_type','!=','ownership_shared')]}"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','ownership')]}"
widget="many2many_attachment_preview"/>
<field name="property_instrument_date"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','!=','ownership'),('property_type','!=','charitable'),('property_type','!=','ownership_shared')]}"/>
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','!=','ownership')]}"/>
<field name="electricity_attach"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type','=',False)]}"
attrs="{'readonly':[('state','not in',['draft','new','complete_info'])],'invisible':[('property_type_code','=',False)]}"
widget="many2many_attachment_preview"/>
</group>
<group string="National address">
@ -1618,10 +1619,10 @@
<field name="total_expenses" nolabel="1" widget="monetary"
options="{'currency_field': 'currency_id'}"/>
<label for="estimated_rent_amount"
attrs="{'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'invisible':[('property_type_code','!=','rent')]}"/>
<field name="estimated_rent_amount" nolabel="1" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"
attrs="{'invisible':[('property_type','!=','rent'),('property_type','!=','rent_shared')]}"/>
attrs="{'invisible':[('property_type_code','!=','rent')]}"/>
<field name="member_income" widget="monetary"
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
<field name="benefit_category_id" readonly="1" force_save="1"/>