Compute total in supplier invoices for:
stock -> create invoice on picking po hr_expense bzr revid: fp@tinyerp.com-9239728dade0c66a15222656f6e3a10a13d6c6ee
This commit is contained in:
parent
7f5ca0808e
commit
17da2d2c79
|
@ -265,7 +265,7 @@ class account_invoice(osv.osv):
|
|||
ait_obj.create(cr, uid, taxe)
|
||||
return True
|
||||
|
||||
def button_compute(self, cr, uid, ids, context={}):
|
||||
def button_compute(self, cr, uid, ids, context={}, set_total=False):
|
||||
ait_obj = self.pool.get('account.invoice.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
|
@ -290,6 +290,8 @@ class account_invoice(osv.osv):
|
|||
for key in compute_taxes:
|
||||
if not key in tax_key:
|
||||
ait_obj.create(cr, uid, compute_taxes[key])
|
||||
if set_total:
|
||||
self.pool.get('account.invoice').write(cr, uid, [inv.id], {'check_total': inv.amount_total})
|
||||
return True
|
||||
|
||||
def _get_analityc_lines(self, cr, uid, id):
|
||||
|
|
|
@ -155,6 +155,7 @@ class hr_expense_expense(osv.osv):
|
|||
if exp.journal_id:
|
||||
inv['journal_id']=exp.journal_id.id
|
||||
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
|
||||
self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
|
||||
self.write(cr, uid, [exp.id], {'invoice_id': inv_id, 'state': 'invoiced'})
|
||||
res = inv_id
|
||||
return res
|
||||
|
|
|
@ -221,6 +221,7 @@ class purchase_order(osv.osv):
|
|||
'invoice_line': il,
|
||||
}
|
||||
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
|
||||
self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
|
||||
|
||||
self.write(cr, uid, [o.id], {'invoice_id': inv_id})
|
||||
res = inv_id
|
||||
|
|
|
@ -552,7 +552,7 @@ class stock_picking(osv.osv):
|
|||
self.pool.get('sale.order.line').write(cr, uid, [line.sale_line_id.id], {
|
||||
'invoice_lines': [(6, 0, [iline_id])]
|
||||
})
|
||||
|
||||
self.pool.get('account.invoice').button_compute(cr, uid, [invoice_id], {'type':'in_invoice'}, set_total=(type in ('in_invoice','in_refund')))
|
||||
self.pool.get('stock.picking').write(cr, uid, [p.id], {'invoice_state': 'invoiced'})
|
||||
if p.sale_id:
|
||||
sids = sales[p.sale_id.id]
|
||||
|
|
Loading…
Reference in New Issue