[IMP] odex_benefit: IMP benefit
This commit is contained in:
parent
f7d824d8ed
commit
d17262219d
|
|
@ -56,6 +56,24 @@ class PaymentOrders(models.Model):
|
|||
company_id = fields.Many2one('res.company', string='Company', default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency',
|
||||
related='company_id.currency_id')
|
||||
can_user_act = fields.Boolean(compute='_compute_can_user_act', store=False)
|
||||
|
||||
@api.depends('state')
|
||||
@api.depends_context('uid')
|
||||
def _compute_can_user_act(self):
|
||||
user = self.env.user
|
||||
for record in self:
|
||||
can_act = False
|
||||
if record.state in ['draft', 'waiting_deposit']:
|
||||
can_act = user.has_group('odex_benefit.group_benefit_payment_accountant_accept')
|
||||
elif record.state == 'waiting_head':
|
||||
can_act = user.has_group('odex25_account_payment_fix.group_depart_manager')
|
||||
elif record.state == 'waiting_finance':
|
||||
can_act = user.has_group('odex25_account_payment_fix.group_accounting_manager')
|
||||
elif record.state == 'waiting_gm':
|
||||
can_act = user.has_group('odex25_account_payment_fix.group_general_manager')
|
||||
|
||||
record.can_user_act = can_act
|
||||
|
||||
@api.depends('service_requests_ids', 'benefit_expense_line_ids')
|
||||
def _compute_total_amount(self):
|
||||
|
|
@ -162,14 +180,6 @@ class PaymentOrders(models.Model):
|
|||
))
|
||||
return super(PaymentOrders, self).unlink()
|
||||
|
||||
# todo remove search override
|
||||
@api.model
|
||||
def search(self, args, offset=0, limit=None, order=None, count=False):
|
||||
if self.env.user and self.env.user.id and self.env.user.has_group(
|
||||
"odex_benefit.group_benefit_payment_accountant_accept"):
|
||||
args += [('accountant_id', '=', self.env.user.id)]
|
||||
return super(PaymentOrders, self).search(args, offset, limit, order, count)
|
||||
|
||||
def _compute_move_count(self):
|
||||
for rec in self:
|
||||
rec.move_count = 1 if rec.move_id else 0
|
||||
|
|
|
|||
|
|
@ -549,7 +549,7 @@
|
|||
<field name="name">Services Requests</field>
|
||||
<field name="res_model">service.request</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('is_seasonal','=',False)]</field>
|
||||
<field name="domain">['|',('is_seasonal','=',False),'&',('is_seasonal','=',True),('state','=','return_to_bank')]</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">Create the Service Request
|
||||
</p>
|
||||
|
|
@ -559,7 +559,20 @@
|
|||
<field name="name">Services Requests</field>
|
||||
<field name="res_model">service.request</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('is_seasonal','=',False),('state','=','accounting_approve'),('payment_order_state','=','none')]</field>
|
||||
<field name="domain">
|
||||
[
|
||||
'|',
|
||||
'&','&',
|
||||
('is_seasonal','=',False),
|
||||
('state','=','accounting_approve'),
|
||||
('payment_order_state','=','none'),
|
||||
'&','&','&',
|
||||
('is_seasonal','=',True),
|
||||
('state','=','accounting_approve'),
|
||||
('payment_order_state','=','none'),
|
||||
('return_reason_id','!=',False)
|
||||
]
|
||||
</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">Create the Service Request
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -7,43 +7,51 @@
|
|||
<form string="Payment Orders" create="false">
|
||||
<header>
|
||||
<button name="action_manager_approval" type="object" states="draft"
|
||||
groups="odex_benefit.group_benefit_payment_accountant_accept"
|
||||
string="Manager approval" class="oe_highlight"/>
|
||||
<button name="action_refuse" type="object"
|
||||
states="draft"
|
||||
groups="odex_benefit.group_benefit_payment_accountant_accept"
|
||||
string="Refuse" class="btn btn-danger"/>
|
||||
|
||||
<button name="action_head_approval" type="object"
|
||||
states="waiting_head"
|
||||
groups="odex25_account_payment_fix.group_depart_manager"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_head"
|
||||
groups="odex25_account_payment_fix.group_depart_manager"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="action_finance_approval" type="object"
|
||||
states="waiting_finance"
|
||||
groups="odex25_account_payment_fix.group_accounting_manager"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_finance"
|
||||
groups="odex25_account_payment_fix.group_accounting_manager"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="action_gm_approval" type="object"
|
||||
states="waiting_gm"
|
||||
groups="odex25_account_payment_fix.group_general_manager"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_gm"
|
||||
groups="odex25_account_payment_fix.group_general_manager"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="create_entry" type="object"
|
||||
groups="odex_benefit.group_benefit_payment_accountant_accept"
|
||||
string="Create Entry" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('state','!=','waiting_deposit'),('move_id', '!=',False)]}"
|
||||
/>
|
||||
<button name="action_deposit" type="object"
|
||||
groups="odex_benefit.group_benefit_payment_accountant_accept"
|
||||
string="Deposit Completed" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('state','!=','waiting_deposit'),('move_id', '=',False)]}"
|
||||
/>
|
||||
|
||||
|
||||
<button name="action_refuse" type="object"
|
||||
states="draft"
|
||||
string="Refuse" class="btn btn-danger"/>
|
||||
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
|
@ -166,43 +174,43 @@
|
|||
decoration-warning="state not in ['draft','done']"
|
||||
decoration-success="state == 'done'"
|
||||
/>
|
||||
<button name="action_manager_approval" type="object" states="draft"
|
||||
<field name="can_user_act" invisible="1"/>
|
||||
<button name="action_manager_approval" type="object"
|
||||
attrs="{'invisible': ['|', ('state','!=','draft'), ('can_user_act','=',False)]}"
|
||||
string="Manager approval" class="oe_highlight"/>
|
||||
<button name="action_refuse" type="object"
|
||||
attrs="{'invisible': ['|', ('state','!=','draft'), ('can_user_act','=',False)]}"
|
||||
string="Refuse" class="btn btn-danger"/>
|
||||
|
||||
<button name="action_head_approval" type="object"
|
||||
states="waiting_head"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_head'), ('can_user_act','=',False)]}"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_head"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_head'), ('can_user_act','=',False)]}"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="action_finance_approval" type="object"
|
||||
states="waiting_finance"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_finance'), ('can_user_act','=',False)]}"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_finance"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_finance'), ('can_user_act','=',False)]}"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="action_gm_approval" type="object"
|
||||
states="waiting_gm"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_gm'), ('can_user_act','=',False)]}"
|
||||
string="Approve" class="oe_highlight"/>
|
||||
<button name="action_reset_to_draft" type="object"
|
||||
states="waiting_gm"
|
||||
attrs="{'invisible': ['|', ('state','!=','waiting_gm'), ('can_user_act','=',False)]}"
|
||||
string="Reset" class="btn btn-warning"/>
|
||||
|
||||
<button name="create_entry" type="object"
|
||||
string="Create Entry" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('state','!=','waiting_deposit'),('move_id', '!=',False)]}"
|
||||
attrs="{'invisible': ['|', '|',('state','!=','waiting_deposit'),('move_id', '!=',False), ('can_user_act','=',False)]}"
|
||||
/>
|
||||
<button name="action_deposit" type="object"
|
||||
string="Deposit Completed" class="oe_highlight"
|
||||
attrs="{'invisible': ['|',('state','!=','waiting_deposit'),('move_id', '=',False)]}"
|
||||
attrs="{'invisible': ['|', '|',('state','!=','waiting_deposit'),('move_id', '=',False), ('can_user_act','=',False)]}"
|
||||
/>
|
||||
|
||||
|
||||
<button name="action_refuse" type="object"
|
||||
states="draft"
|
||||
string="Refuse" class="btn btn-danger"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
Loading…
Reference in New Issue