[FIX] hr-expense : incmplete handling of canceld and reopened invoices
lp bug: https://launchpad.net/bugs/808704 fixed bzr revid: ara@tinyerp.com-20110928121331-p3x76mmel6ity9fs
This commit is contained in:
parent
bdfaf1e37d
commit
ad61a880bf
|
@ -82,6 +82,7 @@ class hr_expense_expense(osv.osv):
|
|||
('accepted', 'Approved'),
|
||||
('invoiced', 'Invoiced'),
|
||||
('paid', 'Reimbursed'),
|
||||
('invoice_except', 'Invoice Exception'),
|
||||
('cancelled', 'Refused')],
|
||||
'State', readonly=True, help='When the expense request is created the state is \'Draft\'.\n It is confirmed by the user and request is sent to admin, the state is \'Waiting Confirmation\'.\
|
||||
\nIf the admin accepts it, the state is \'Accepted\'.\n If an invoice is made for the expense request, the state is \'Invoiced\'.\n If the expense is paid to user, the state is \'Reimbursed\'.'),
|
||||
|
@ -224,6 +225,10 @@ class hr_expense_expense(osv.osv):
|
|||
res = inv_id
|
||||
return res
|
||||
|
||||
def action_invoice_cancel(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'invoice_except'}, context=context)
|
||||
return True
|
||||
|
||||
hr_expense_expense()
|
||||
|
||||
class product_product(osv.osv):
|
||||
|
|
|
@ -106,6 +106,7 @@
|
|||
<button name="confirm" states="draft" string="Submit to Manager" type="workflow" icon="gtk-apply"/>
|
||||
<button name="invoice" states="accepted" string="Invoice" type="object" icon="gtk-go-forward" groups="base.group_hr_user"/>
|
||||
<button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
|
||||
<button name="invoice_recreate_hr_expense" states="invoice_except" string="Recreate Invoice" icon="gtk-go-forward"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Info" groups="base.group_extended">
|
||||
|
|
|
@ -55,6 +55,13 @@
|
|||
<field name="action">action_invoice_create()</field>
|
||||
</record>
|
||||
|
||||
<record id="act_invoice_except" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_expenses"/>
|
||||
<field name="name">invoice_except</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_invoice_cancel()</field>
|
||||
</record>
|
||||
|
||||
<record id="t1" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_confirm"/>
|
||||
|
@ -117,5 +124,18 @@
|
|||
<field name="group_id" ref="base.group_hr_user"/>
|
||||
</record>
|
||||
|
||||
<record id="t12" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_except"/>
|
||||
<field name="signal">subflow.cancel</field>
|
||||
<field name="group_id" ref="base.group_hr_user"/>
|
||||
</record>
|
||||
|
||||
<record id="t13" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice_except"/>
|
||||
<field name="act_to" ref="act_invoice"/>
|
||||
<field name="signal">invoice_recreate_hr_expense</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue