parent
fce301c235
commit
7a71b55ef5
|
@ -338,19 +338,17 @@ class purchase_order(osv.osv):
|
|||
raise osv.except_osv(
|
||||
_('Could not cancel purchase order !'),
|
||||
_('You must first cancel all packings attached to this purchase order.'))
|
||||
for r in self.read(cr,uid,ids,['picking_ids']):
|
||||
for pick in r['picking_ids']:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr)
|
||||
for inv in purchase.invoice_ids:
|
||||
if inv.state not in ('draft','cancel'):
|
||||
raise osv.except_osv(
|
||||
_('Could not cancel this purchase order !'),
|
||||
_('You must first cancel all invoices attached to this purchase order.'))
|
||||
for r in self.read(cr,uid,ids,['invoice_ids']):
|
||||
for inv in r['invoice_ids']:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.invoice', inv, 'invoice_cancel', cr)
|
||||
for pick in purchase.picking_ids:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
|
||||
inv = purchase.invoice_id
|
||||
if inv and inv.state not in ('cancel','draft'):
|
||||
raise osv.except_osv(
|
||||
_('Could not cancel this purchase order !'),
|
||||
_('You must first cancel all invoices attached to this purchase order.'))
|
||||
if inv:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
|
||||
self.write(cr,uid,ids,{'state':'cancel'})
|
||||
return True
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@
|
|||
<field name="amount_total" sum="Total amount"/>
|
||||
<button name="button_dummy" states="draft" string="Compute" type="object"/>
|
||||
</group>
|
||||
<group col="10" colspan="4">
|
||||
<group col="11" colspan="4">
|
||||
<field name="state" readonly="1"/>
|
||||
<button name="purchase_confirm" states="draft" string="Confirm Purchase Order"/>
|
||||
<button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase"/>
|
||||
<button name="purchase_approve" states="confirmed" string="Approved by Supplier"/>
|
||||
<button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
|
||||
<button name="action_cancel" states="approved" string="Cancel Purchase Order" type="object"/>
|
||||
<button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Purchase Order" type="object"/>
|
||||
|
||||
<button name="picking_ok" states="except_picking" string="Manually Corrected"/>
|
||||
<button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<record id="act_invoice_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="purchase_order"/>
|
||||
<field name="name">invoice_done</field>
|
||||
<field name="action">write({'invoiced':1})</field>
|
||||
<field name="action">write({'invoiced':1,'state':'approved'})</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
<record id="act_invoice_end" model="workflow.activity">
|
||||
|
@ -72,7 +72,7 @@
|
|||
<record id="act_picking_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="purchase_order"/>
|
||||
<field name="name">picking_done</field>
|
||||
<field name="action">write({'shipped':1})</field>
|
||||
<field name="action">write({'shipped':1,'state':'approved'})</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="signal_send">subflow.delivery_done</field>
|
||||
</record>
|
||||
|
|
Loading…
Reference in New Issue