[MERGE] Account: product - VAT definition - multicompany
bzr revid: mra@mra-laptop-20101210121327-190r00083k99d08n
This commit is contained in:
commit
fa2a2db80e
|
@ -1312,6 +1312,7 @@ class account_invoice_line(osv.osv):
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
company_id = context.get('company_id',False)
|
company_id = context.get('company_id',False)
|
||||||
|
tax_obj = self.pool.get('account.tax')
|
||||||
if not partner_id:
|
if not partner_id:
|
||||||
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
|
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
|
||||||
if not product:
|
if not product:
|
||||||
|
@ -1400,17 +1401,24 @@ class account_invoice_line(osv.osv):
|
||||||
if a:
|
if a:
|
||||||
result['account_id'] = a
|
result['account_id'] = a
|
||||||
|
|
||||||
|
tax_ids = tax_obj.search(cr, uid, [('company_id', '=', company_id)])
|
||||||
if type in ('out_invoice', 'out_refund'):
|
if type in ('out_invoice', 'out_refund'):
|
||||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
sale_taxes_def = map(lambda x: x.id, res.taxes_id)
|
||||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
sale_tax_ids = [tax for tax in tax_ids if tax in sale_taxes_def]
|
||||||
|
sale_taxes = tax_obj.browse(cr, uid, sale_tax_ids)
|
||||||
|
sale_taxes_all = sale_taxes and sale_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||||
|
tax_id = fpos_obj.map_tax(cr, uid, fpos, sale_taxes_all)
|
||||||
else:
|
else:
|
||||||
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)
|
pur_taxes_def = map(lambda x: x.id, res.supplier_taxes_id)
|
||||||
tax_id = fpos_obj.map_tax(cr, uid, fpos, taxes)
|
pur_tax_ids = [tax for tax in tax_ids if tax in pur_taxes_def]
|
||||||
|
pur_taxes = tax_obj.browse(cr, uid, pur_tax_ids)
|
||||||
|
pur_taxes_all = pur_taxes and pur_taxes or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||||
|
tax_id = fpos_obj.map_tax(cr, uid, fpos, pur_taxes_all)
|
||||||
|
|
||||||
if type in ('in_invoice', 'in_refund'):
|
if type in ('in_invoice', 'in_refund'):
|
||||||
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
|
result.update( {'price_unit': price_unit or res.standard_price,'invoice_line_tax_id': tax_id} )
|
||||||
else:
|
else:
|
||||||
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
|
result.update({'price_unit': res.list_price, 'invoice_line_tax_id': tax_id})
|
||||||
|
|
||||||
# if not name:
|
# if not name:
|
||||||
result['name'] = res.partner_ref
|
result['name'] = res.partner_ref
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue