[IMP] purchase: added print button to print quotation

bzr revid: cha@tinyerp.com-20121123133619-t827uucsw6obilcz
This commit is contained in:
Ajay Chauhan (OpenERP) 2012-11-23 19:06:19 +05:30
parent d1fa9916dc
commit 2f47a6be9f
2 changed files with 16 additions and 0 deletions

View File

@ -413,6 +413,20 @@ class purchase_order(osv.osv):
'context': ctx,
}
def print_quotation(self, cr, uid, ids, context=None):
'''
This function prints the request for quotation and mark it as sent, so that we can see more easily the next step of the workflow
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.order', ids[0], 'send_rfq', cr)
datas = {
'model': 'purchase.order',
'ids': ids,
'form': self.read(cr, uid, ids[0], context=context),
}
return {'type': 'ir.actions.report.xml', 'report_name': 'purchase.quotation', 'datas': datas, 'nodestroy': True}
#TODO: implement messages system
def wkf_confirm_order(self, cr, uid, ids, context=None):
todo = []

View File

@ -199,6 +199,8 @@
<form string="Purchase Order" version="7.0">
<header>
<button name="wkf_send_rfq" states="draft" string="Send Request for Quotation" type="object" context="{'send_rfq':True}" class="oe_highlight"/>
<button name="print_quotation" string="Print" type="object" states="draft" class="oe_highlight" groups="base.group_user"/>
<button name="print_quotation" string="Print" type="object" states="sent" groups="base.group_user"/>
<button name="purchase_confirm" states="draft" string="Confirm Order"/>
<button name="purchase_confirm" states="sent" string="Confirm Order" class="oe_highlight"/>
<button name="wkf_send_rfq" states="confirmed" string="Resend Purchase Order" type="object" class="oe_highlight"/>