[FIX] bugfixed the incoming tax on onchange of product in supplier invoice and refund
[FIX] bugfixed the invoice validation: if we were setting up a customer invoice with a tax in one line and validated it without pressing the compute button first, it was creating the tax line twice. bzr revid: qdp@tinyerp.com-20090127100608-u942qhh9egpa420f
This commit is contained in:
parent
c88824db3e
commit
7d19b0fd1e
|
@ -483,13 +483,9 @@ class account_invoice(osv.osv):
|
||||||
cur_obj = self.pool.get('res.currency')
|
cur_obj = self.pool.get('res.currency')
|
||||||
|
|
||||||
for inv in self.browse(cr, uid, ids):
|
for inv in self.browse(cr, uid, ids):
|
||||||
if not inv.tax_line:
|
|
||||||
self.button_compute(cr, uid, [inv.id], context={}, set_total=False)
|
|
||||||
if inv.move_id:
|
if inv.move_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
|
|
||||||
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
|
|
||||||
if not inv.date_invoice:
|
if not inv.date_invoice:
|
||||||
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
|
self.write(cr, uid, [inv.id], {'date_invoice':time.strftime('%Y-%m-%d')})
|
||||||
company_currency = inv.company_id.currency_id.id
|
company_currency = inv.company_id.currency_id.id
|
||||||
|
@ -519,6 +515,9 @@ class account_invoice(osv.osv):
|
||||||
if not key in tax_key:
|
if not key in tax_key:
|
||||||
raise osv.except_osv(_('Warning !'), _('Taxes missing !'))
|
raise osv.except_osv(_('Warning !'), _('Taxes missing !'))
|
||||||
|
|
||||||
|
if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
|
||||||
|
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
|
||||||
|
|
||||||
# one move line per tax line
|
# one move line per tax line
|
||||||
iml += ait_obj.move_line_get(cr, uid, inv.id)
|
iml += ait_obj.move_line_get(cr, uid, inv.id)
|
||||||
|
|
||||||
|
@ -986,7 +985,7 @@ class account_invoice_line(osv.osv):
|
||||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
||||||
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||||
else:
|
else:
|
||||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
||||||
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||||
if type in ('in_invoice', 'in_refund'):
|
if type in ('in_invoice', 'in_refund'):
|
||||||
to_update = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)
|
to_update = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)
|
||||||
|
|
Loading…
Reference in New Issue