[IMP] purchase : Remove the warning when 'based on PO lines' but generate the invoice instead.
bzr revid: mdi@tinyerp.com-20120305104856-5n9x4ntz8jitcywf
This commit is contained in:
parent
900d064e3e
commit
314f9586d0
|
@ -276,12 +276,13 @@ class purchase_order(osv.osv):
|
||||||
|
|
||||||
def view_invoice(self, cr, uid, ids, context=None):
|
def view_invoice(self, cr, uid, ids, context=None):
|
||||||
mod_obj = self.pool.get('ir.model.data')
|
mod_obj = self.pool.get('ir.model.data')
|
||||||
|
wizard_obj = self.pool.get('purchase.order.line_invoice')
|
||||||
inv_ids = []
|
inv_ids = []
|
||||||
for po in self.browse(cr, uid, ids, context=context):
|
for po in self.browse(cr, uid, ids, context=context):
|
||||||
if po.invoice_method == 'manual':
|
if po.invoice_method == 'manual':
|
||||||
if not po.invoice_ids:
|
if not po.invoice_ids:
|
||||||
raise osv.except_osv(_('warning !'),
|
context.update({'active_ids' : [line.id for line in po.order_line]})
|
||||||
_('Your Invoicing Control is based on order lines, so please create invoice from Purchase order lines.'))
|
wizard_obj.makeInvoices(cr, uid, [], context=context)
|
||||||
inv_ids+= [invoice.id for invoice in po.invoice_ids]
|
inv_ids+= [invoice.id for invoice in po.invoice_ids]
|
||||||
|
|
||||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
|
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
|
||||||
|
|
Loading…
Reference in New Issue