Externalize _make_invoice to allow easy override
bzr revid: ced-8e2e06f77a969347ee57005d956112b998273794
This commit is contained in:
parent
a5e357ee3a
commit
a9b6ba1676
|
@ -211,12 +211,7 @@ class sale_order(osv.osv):
|
|||
def _inv_get(self, cr, uid, order, context={}):
|
||||
return {}
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
|
||||
res = False
|
||||
invoices = {}
|
||||
invoice_ids = []
|
||||
|
||||
def make_invoice(order, lines):
|
||||
def _make_invoice(self, cr, uid, order, lines):
|
||||
a = order.partner_id.property_account_receivable.id
|
||||
if order.partner_id and order.partner_id.property_payment_term.id:
|
||||
pay_term = order.partner_id.property_payment_term.id
|
||||
|
@ -247,6 +242,12 @@ class sale_order(osv.osv):
|
|||
inv_obj.button_compute(cr, uid, [inv_id])
|
||||
return inv_id
|
||||
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
|
||||
res = False
|
||||
invoices = {}
|
||||
invoice_ids = []
|
||||
|
||||
for o in self.browse(cr,uid,ids):
|
||||
lines = []
|
||||
for line in o.order_line:
|
||||
|
@ -264,13 +265,13 @@ class sale_order(osv.osv):
|
|||
|
||||
for val in invoices.values():
|
||||
if grouped:
|
||||
res = make_invoice(val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []))
|
||||
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []))
|
||||
for o,l in val:
|
||||
self.write(cr, uid, [o.id], {'state' : 'progress'})
|
||||
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (o.id, res))
|
||||
else:
|
||||
for order, il in val:
|
||||
res = make_invoice(order, il)
|
||||
res = self._make_invoice(cr, uid, order, il)
|
||||
invoice_ids.append(res)
|
||||
self.write(cr, uid, [order.id], {'state' : 'progress'})
|
||||
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (order.id, res))
|
||||
|
|
Loading…
Reference in New Issue