summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Pinckaers <fp@tinyerp.com>2007-06-26 18:11:29 +0000
committerFabien Pinckaers <fp@tinyerp.com>2007-06-26 18:11:29 +0000
commit17da2d2c7952f4ffda74f29b8063d8b22ea28fa2 (patch)
treeda3dd41422f3829d555d4b4c947f6d29076b7794
parent7f5ca0808e819d70a3a9f5ae55bbb422e76fa235 (diff)
Compute total in supplier invoices for:
stock -> create invoice on picking po hr_expense bzr revid: fp@tinyerp.com-9239728dade0c66a15222656f6e3a10a13d6c6ee
-rw-r--r--addons/account/invoice.py4
-rw-r--r--addons/hr_expense/hr_expense.py1
-rw-r--r--addons/purchase/purchase.py1
-rw-r--r--addons/stock/stock.py2
4 files changed, 6 insertions, 2 deletions
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index a08be48b757..ac974e8e18b 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -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):
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index e2c14f46659..e15bab6cd6e 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -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
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index f19ba079b31..e7c3b11a1b0 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -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
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index f27680f3dcd..b29899b8d96 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -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]