Merge pull request #4797 from expsa/samir-aladawi-service-requests-updates

Samir aladawi service requests updates
This commit is contained in:
SamirLADOUI-sa 2025-10-02 10:30:04 +01:00 committed by GitHub
commit 8d3c5bb4f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 38 additions and 34 deletions

View File

@ -438,48 +438,52 @@ class ServiceRequest(models.Model):
rec.amount_for_buy_home_for_member_count = 0
if rec.service_type == 'buy_home':
rec.amount_for_buy_home_for_member_count = (rec.service_cat.buy_home_lines.filtered(lambda x : x.min_count_member <= rec.benefit_member_count <= rec.benefit_member_count)).amount_for_buy_home
def action_for_researcher(self):
def action_send_to_researcher(self):
for rec in self:
rec.state = 'researcher'
def action_send_request(self):
def action_researcher_send_request(self):
for rec in self:
rec.state = 'send_request'
def action_first_approve(self):
def action_operations_chief_approve(self):
for rec in self:
rec.state = 'first_approve'
def action_second_approve(self):
def action_branch_manager_approve(self):
for rec in self:
if rec.service_cat.needs_beneficiary_manager_approval:
rec.state = 'second_approve'
else:
rec.state = 'accounting_approve'
def action_approval_of_beneficiary_services(self):
def action_beneficiary_manager_approve(self):
for rec in self:
rec.state = 'approval_of_beneficiary_services'
rec.state = 'accounting_approve'
def action_accounting_approve(self):
for rec in self:
rec.state = 'accounting_approve'
if rec.service_type == 'buy_car':
rec.family_id.has_car = True
def action_send_request_to_supplier(self):
for rec in self:
if rec.service_cat.service_type == 'electrical_devices':
if rec.service_type == 'electrical_devices':
rec.state = 'approval_of_beneficiary_services'
else:
if rec.service_type == 'buy_car':
rec.family_id.has_car = True
rec.state = 'send_request_to_supplier'
def action_family_received_device(self):
def action_supplier_approve(self):
for rec in self:
rec.state = 'send_request_to_supplier'
def action_request_done(self):
for rec in self:
rec.state = 'family_received_device'
def action_accounting_first_refuse(self):
def action_send_request_to_supplier(self):
for rec in self:
rec.state = 'family_received_device'
def action_first_refuse(self):
return {
'name': 'Reason for Returning the Request',
'type': 'ir.actions.act_window',
@ -488,7 +492,6 @@ class ServiceRequest(models.Model):
'target': 'new',
}
def action_refuse(self):
# for rec in self:
# rec.state = 'refused'

View File

@ -7,40 +7,41 @@
<field name="arch" type="xml">
<form string="Service Request">
<header>
<button name="action_for_researcher" type="object" states="draft"
<button name="action_send_to_researcher" type="object" states="draft"
string="Researcher Accept" class="oe_highlight"/>
<button name="action_send_request" type="object" states="researcher"
<button name="action_researcher_send_request" type="object" states="researcher"
string="Send Request" class="oe_highlight"/>
<button name="action_first_approve" type="object"
<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" groups="odex_benefit.group_benefit_woman_commitee,odex_benefit.group_benefit_manager"/>
<button name="action_second_approve" type="object"
<button name="action_branch_manager_approve" type="object"
string="Request Second Approve" class="oe_highlight"
confirm="Are you sure you want to second approve ?"
states="first_approve" groups="odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"/>
<button name="action_beneficiary_manager_approve" type="object"
string="Beneficiary Approve" class="oe_highlight"
confirm="Are you sure you want to approve ?"
states="second_approve" groups="odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"/>
<button name="action_accounting_approve" type="object"
string="Accounting Approve" class="oe_highlight"
confirm="Are you sure you want to approve ?"
states="accounting_approve" groups="odex_benefit.group_benefit_accounting_accept"/>
<button name="action_accounting_first_refuse" type="object"
<button name="action_supplier_approve" type="object"
string="Supplier Approve" class="oe_highlight"
confirm="Are you sure you want to approve ?"
states="approval_of_beneficiary_services" groups="odex_benefit.group_benefit_accounting_accept"/>
<button name="action_request_done" type="object"
string="Family Received Device" class="oe_highlight"
groups="odex_benefit.group_benefit_accounting_accept" states="send_request_to_supplier" />
<button name="action_first_refuse" type="object"
string="Return the request to the specialist" class="oe_highlight"
attrs="{'invisible': ['|',('return_reason','!=', False), ('state', 'not in', ['accounting_approve', 'second_approve' ,'send_request' ,'first_approve'])]}"
groups="odex_benefit.group_benefit_accounting_accept,odex_benefit.group_benefit_woman_commitee,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager"/>
<button name="action_send_request_to_supplier" type="object"
string="Send Request To Supplier" class="oe_highlight"
confirm="Are you sure you want to send request to supplier ?"
groups="odex_benefit.group_benefit_accounting_accept" attrs="{'invisible': ['|',('service_type','!=','electrical_devices'),('state','!=','accounting_approve')]}" />
<button name="action_family_received_device" type="object"
string="Family Received Device" class="oe_highlight"
groups="odex_benefit.group_benefit_accounting_accept" attrs="{'invisible': ['|',('service_type','!=','electrical_devices'),('state','!=','send_request_to_supplier')]}" />
<button name="action_refuse" type="object"
string="Refuse" class="oe_highlight"
states="first_approve,second_approve,draft,send_request"/>
<!-- <field name="state" widget="statusbar" invisible="1"/> -->
<field name="state" widget="statusbar" statusbar_visible="draft,researcher,send_request,first_approve,accounting_approve,send_request_to_supplier,family_received_device,refused"/>
<!-- <field name="state_a" widget="statusbar" statusbar_visible="draft,researcher,send_request,first_approve,second_approve,accounting_approve,refused" attrs="{'invisible': [('service_type','=','electrical_devices')]}"/>
<field name="state_b" widget="statusbar" statusbar_visible="draft,researcher,send_request,first_approve,second_approve,accounting_approve,send_request_to_supplier,family_received_device,refused" attrs="{'invisible': [('service_type','!=','electrical_devices')]}" groups="odex_benefit.group_benefit_accounting_accept"/> -->
</header>
<sheet>
<field name="is_payment_order_done" invisible="1"/>

View File

@ -11,7 +11,7 @@
<field name="project_create" invisible="1"/>
<field name="project_id" readonly="1" attrs="{'invisible': ['|',('state','!=','accounting_approve'),('project_create', '=',False)]}"/>
</xpath>
<xpath expr="//button[@name='action_second_approve']" position="after">
<!-- <xpath expr="//button[@name='action_branch_manager_approve']" position="after">
<button name="action_approval_of_beneficiary_services" type="object"
string="Approval of beneficiary services" class="oe_highlight"
confirm="Are you sure you want to approval beneficiary services ?" groups="odex_benefit.group_approval_of_beneficiary_services" attrs="{'invisible': ['|',('project_create', '=', False),('state', '!=', 'second_approve')]}"/>
@ -29,7 +29,7 @@
confirm="Are you sure you want to approve ?"
attrs="{'invisible':['|',('state','!=','second_approve'),('project_create', '=', True)]}"
groups="odex_benefit.group_benefit_accounting_accept"/>
</xpath>
</xpath> -->
</field>
</record>
</data>