Merge pull request #4903 from expsa/you_dev_odex25_ensan

IMP benefit
This commit is contained in:
kchyounes19 2025-10-14 15:26:53 +01:00 committed by GitHub
commit e1294cd1d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 74 additions and 48 deletions

View File

@ -10029,11 +10029,6 @@ msgstr "تاريخ الطلب"
msgid "Request First Approve"
msgstr "اعتماد رئيس العمليات للطلب"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__service_request__state__first_approve
msgid "Request First Approve"
msgstr "بانتظار مدير الفرع"
#. module: odex_benefit
#: code:addons/odex_benefit/controllers/benefit_services.py:0
#, python-format
@ -10472,15 +10467,9 @@ msgstr "نفس"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.service_request_form
#: model_terms:ir.ui.view,arch_db:odex_benefit.service_request_search
msgid "Send Request"
msgstr "إرسال الطلب"
#. module: odex_benefit
#: model:ir.model.fields.selection,name:odex_benefit.selection__service_request__state__send_request
msgid "Send Request"
msgstr "بانتظار رئيسة العمليات"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_form
msgid "Send Reset Password"
@ -15742,7 +15731,7 @@ msgstr "طريقة الحد الأقصى"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__needs_beneficiary_manager_approval
msgid "Needs Beneficiary Manager Approval"
msgstr "هل تحتاج موافقة مدير المستفيدين؟"
msgstr "موافقة مساعد المدير العام"
#. module: odex_benefit
#: code:addons/odex_benefit/models/family_members.py:0
@ -16388,6 +16377,26 @@ msgstr "عمر العضو"
msgid "Orphaned (Both Parents Deceased)"
msgstr "فاقد الأبوين"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.services_settings_form
msgid "Service Approvals"
msgstr "موافقات الخدمة"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__needs_services_head_approval
msgid "Needs Services Head Approval"
msgstr "موافقة مديرة الخدمات الأسرية"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__needs_legal_approval
msgid "Needs Legal Approval"
msgstr "موافقة الإدارة القانونية"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__needs_project_management_approval
msgid "Needs Project Management Approval"
msgstr "موافقة إدارة المشاريع"
#. module: odex_benefit
#: model_terms:ir.ui.view,arch_db:odex_benefit.services_settings_form
msgid "Services Attachments"
@ -16422,4 +16431,4 @@ msgstr "معلومات عقد الإيجار الجديد"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__new_rent_amount_payment
msgid "New Rent Amount Payment"
msgstr "مبلغ دفع الإيجار الجديد"
msgstr "مبلغ دفع الإيجار الجديد"

View File

@ -1243,8 +1243,8 @@ class GrantBenefitProfile(models.Model):
record.partner_id.get_partner_name() # Force recomputation of name
if record.user_id:
record.sudo().user_id.write({"name": record.partner_id.name})
if not self.env.context.get('force_website', False) and not self.env.context.get('bypass_attachments_requirement', False):
self._validate_required_attachments()
#if not self.env.context.get('force_website', False) and not self.env.context.get('bypass_attachments_requirement', False):
# self._validate_required_attachments()
# Handle mother update/create
mother_fields = [
@ -1284,8 +1284,8 @@ class GrantBenefitProfile(models.Model):
res.user_id.sudo().write({"name": vals.get("name")})
if res.user_id:
res.sudo().user_id.write({"name": res.name})
if not self.env.context.get('force_website', False):
res._validate_required_attachments()
#if not self.env.context.get('force_website', False):
##res._validate_required_attachments()
if not res.code or res.code == _('New'):
res.code = self.env['ir.sequence'].sudo().next_by_code('benefit.sequence') or _('New')
# Add mother

View File

@ -144,8 +144,8 @@ class ServiceRequest(models.Model):
state = fields.Selection( selection = [
('draft', 'Draft'),
('researcher', 'Researcher'),
('send_request', 'Send Request'),
('first_approve', 'Request First Approve'),
('waiting_approve', 'Waiting for Operation Manager'),
('first_approve', 'Waiting for Branch Manager'),
('second_approve', 'Request Second Approve'),
('accounting_approve', 'Accounting Approve'),
('approval_of_beneficiary_services', 'Approval of beneficiary services'),
@ -153,6 +153,7 @@ class ServiceRequest(models.Model):
('family_received_device', 'Family Received Device'),
('refused', 'Refused')
], string='state',default='draft', tracking=True, group_expand='_expand_states')
#dynamic_state = fields.Selection(selection=[],string="State",default='draft',tracking=True,)
state_a = fields.Selection(related='state', tracking=False)
state_b = fields.Selection(related='state', tracking=False)
refuse_reason_id = fields.Many2one('service.refuse.reason', string="Refuse Reason")
@ -431,7 +432,7 @@ class ServiceRequest(models.Model):
def action_researcher_send_request(self):
for rec in self:
rec.state = 'send_request'
rec.state = 'waiting_approve'
def action_operations_chief_approve(self):
for rec in self:

View File

@ -102,7 +102,10 @@ class ServicesSettings(models.Model):
('service', 'Amount by Service'),
], string="Max Limit Type"
)
needs_beneficiary_manager_approval = fields.Boolean()
needs_beneficiary_manager_approval = fields.Boolean("Needs Beneficiary Manager Approval")
needs_services_head_approval = fields.Boolean(string="Needs Services Head Approval")
needs_legal_approval = fields.Boolean(string="Needs Legal Approval")
needs_project_management_approval = fields.Boolean(string="Needs Project Management Approval")
allow_non_beneficiary = fields.Boolean(string="Allow Non Beneficiary")

View File

@ -19,16 +19,16 @@
<button name="action_operations_chief_approve" type="object"
string="Request First Approve" class="oe_highlight"
confirm="Are you sure you want to first approve ?"
states="send_request"
states="waiting_approve"
groups="odex_benefit.group_benefit_woman_commitee"
/>
<button name="action_first_refuse" type="object"
string="Return the request to the specialist" class="btn btn-warning"
states="send_request"
states="waiting_approve"
groups="odex_benefit.group_benefit_woman_commitee"/>
<button name="action_refuse" type="object"
string="Refuse" class="btn btn-danger"
states="send_request"
states="waiting_approve"
groups="odex_benefit.group_benefit_woman_commitee"
/>
<button name="action_branch_manager_approve" type="object"
@ -94,7 +94,8 @@
states="second_approve"
groups="odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,researcher,send_request,first_approve,accounting_approve,send_request_to_supplier,family_received_device,refused"/>
statusbar_visible="draft,researcher,waiting_approve,first_approve,accounting_approve,send_request_to_supplier,family_received_device,refused"/>
</header>
<sheet>
<field name="is_payment_order_done" invisible="1"/>
@ -108,13 +109,13 @@
</div>
<group>
<field name="date"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
required="1"/>
<field name="benefit_type"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
required="1"/>
<field name="family_id"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
required="1"/>
<field name="family_category" force_save="1"/>
<field name="researcher_id" force_save="1"/>
@ -123,48 +124,48 @@
attrs="{'invisible':['|',('service_type','!=','eid_gift'),('benefit_type','!=','family')]}"/>
<field name="branch_custom_id" force_save="1"/>
<field name="member_id"
attrs="{'invisible':[('benefit_type','!=','member')],'readonly':[('state','not in',['draft','researcher','send_request'])],'required':[('benefit_type','=','member')]}"/>
attrs="{'invisible':[('benefit_type','!=','member')],'readonly':[('state','not in',['draft','researcher','waiting_approve'])],'required':[('benefit_type','=','member')]}"/>
<field name="member_age" attrs="{'invisible':[('benefit_type','!=','member')]}"/>
<field name="member_payroll" attrs="{'invisible':[('service_type','!=','marriage')]}"/>
<field name="account_id" invisible="1"/>
<field name="device_account_id" invisible="1"/>
<field name="accountant_id"
attrs="{'invisible':[('state','in',['draft','researcher','send_request','first_approve','second_approve'])]}"/>
attrs="{'invisible':[('state','in',['draft','researcher','waiting_approve','first_approve','second_approve'])]}"/>
<field name="payment_order_id" readonly="1"
groups="odex_benefit.group_benefit_accounting_accept" invisible="1"/>
<field name="vendor_bill" readonly="1"
attrs="{'invisible':[('service_type','!=','electrical_devices')]}"/>
<field name="is_service_producer" invisible="1"/>
<field name="service_producer_id"
attrs="{'invisible':[('is_service_producer','=',False)],'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'invisible':[('is_service_producer','=',False)],'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="available_service_cats" invisible="1"/>
<field name="service_cat"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
domain="[('id','in',available_service_cats)]" required="1"/>
<field name="is_orphan" attrs="{'invisible':[('service_type', '!=', 'marriage')]}"/>
<field name="service_approval_date"/>
<field name="need_status"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<field name="main_service_category"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
invisible="1"/>
<field name="sub_service_category"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
invisible="1"/>
<field name="requested_service_amount" attrs="{'readonly': [
'|',
'&amp;',
('state', 'not in', ['draft', 'researcher', 'send_request', 'first_approve', 'second_approve', 'accounting_approve']),
('state', 'not in', ['draft', 'researcher', 'waiting_approve', 'first_approve', 'second_approve', 'accounting_approve']),
('service_type', 'in', ['marriage', 'eid_gift', 'winter_clothing', 'ramadan_basket']),
('service_type', 'in', ['electrical_devices', 'home_furnishing'])
]}" force_save="1" required="1"/>
<field name="service_max_amount" force_save="1" readonly="1"/>
<field name="service_max_amount" force_save="1" readonly="1"/>
<field name="exception"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<field name="exception_attach" attrs="{'invisible': [('exception', '=', False)]}"
widget="many2many_attachment_preview"/>
<field name="amount_for_buy_home_for_member_count"
@ -172,10 +173,10 @@
<field name="home_age" attrs="{'invisible':[('service_type','!=','buy_home')]}"/>
<field name="aid_amount" invisible="1"/>
<field name="description"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<field name="service_attach" invisible="1" widget="many2many_attachment_preview"/>
<field name="has_marriage_course"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])],'invisible':[('service_type','!=','marriage')],'required':[('service_type','=','marriage')]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])],'invisible':[('service_type','!=','marriage')],'required':[('service_type','=','marriage')]}"/>
<field name="service_type" invisible="1"/>
<field name="refuse_reason_id" attrs="{'invisible': [('refuse_reason_id', '=', False)]}"
readonly="1"/>
@ -222,14 +223,14 @@
<label for="start" string="Period"/>
<div name="dates" class="o_row">
<field name="start"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<i class="fa fa-long-arrow-right mx-2 oe_edit_only"
aria-label="Arrow icon" title="Arrow"/>
<i class="fa fa-long-arrow-right mx-2 oe_read_only"
aria-label="Arrow icon" title="Arrow"
attrs="{'invisible': [('start', '=', False), ('end', '=', False)]}"/>
<field name="end"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
</div>
<field name="rent_amount"
attrs="{'invisible':[('benefit_type','!=','family')]}"
@ -288,14 +289,14 @@
<div name="dates" class="o_row"
attrs="{'invisible':[('benefit_type','!=','family')]}">
<field name="new_start"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
<i class="fa fa-long-arrow-right mx-2 oe_edit_only"
aria-label="Arrow icon" title="Arrow"/>
<i class="fa fa-long-arrow-right mx-2 oe_read_only"
aria-label="Arrow icon" title="Arrow"
attrs="{'invisible': [('new_start', '=', False), ('new_end', '=', False)]}"/>
<field name="new_end"
attrs="{'readonly':[('state','not in',['draft','researcher','send_request'])]}"/>
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
</div>
<field name="new_rent_amount"
attrs="{'invisible':[('benefit_type','!=','family')]}"/>
@ -399,7 +400,7 @@
<field name="state" widget="badge" decoration-success="state in ['second_approve']"
decoration-muted="state == 'draft'"
decoration-danger="state in ['refused']"
decoration-info="state in ['first_approve','send_request']"
decoration-info="state in ['first_approve','waiting_approve']"
decoration-warning="state in ['researcher']"/>
</tree>
</field>
@ -421,7 +422,7 @@
<filter string="Draft" name="draft" domain="[('state','=','draft')]"/>
<separator/>
<separator/>
<filter string="Send Request" name="send_request" domain="[('state', '=', 'send_request')]"/>
<filter string="Waiting for Operation Manager" name="waiting_approve" domain="[('state', '=', 'waiting_approve')]"/>
<separator/>
<separator/>
<filter string="Request First Approve" name="first_approve"

View File

@ -75,11 +75,12 @@
<group>
<field name="is_main_service" invisible="1" widget="boolean_toggle"/>
<field name="is_service_producer" widget="boolean_toggle"
attrs="{'invisible':[('is_main_service','=',True)]}"/>
<field name="is_this_service_for_student" widget="boolean_toggle"
attrs="{'invisible':[('is_main_service','=',True)]}"/>
attrs="{'invisible':[('service_type','=','main_service')]}"/>
<field name="is_this_service_for_student" invisible="1"
widget="boolean_toggle"/>
<field name="needs_beneficiary_manager_approval" widget="boolean_toggle"
attrs="{'invisible':[('service_type','=','main_service')]}"/>
</group>
<group>
<field name="required_attach" widget="boolean_toggle"
@ -235,6 +236,17 @@
</tree>
</field>
</page>
<page string="Service Approvals">
<group>
<group>
<field name="needs_services_head_approval" widget="boolean_toggle"/>
<field name="needs_legal_approval" widget="boolean_toggle"/>
<field name="needs_project_management_approval" widget="boolean_toggle"/>
<field name="needs_beneficiary_manager_approval" widget="boolean_toggle"
attrs="{'invisible':[('is_main_service','=',True)]}"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>