[FIX] account_anglo_saxon: account selection for onchange
Following 3a50d4b3
, should not distinguish invoice and refund for account
selection in anglo-saxon.
Do this in both onchange method and invoice creation from picking.
This commit is contained in:
parent
d9e0997ffd
commit
f63acd9902
|
@ -50,14 +50,9 @@ class account_invoice_line(osv.osv):
|
||||||
return res
|
return res
|
||||||
if type in ('in_invoice','in_refund'):
|
if type in ('in_invoice','in_refund'):
|
||||||
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||||
if type == 'in_invoice':
|
oa = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id
|
||||||
oa = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id
|
if not oa:
|
||||||
if not oa:
|
oa = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id
|
||||||
oa = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id
|
|
||||||
else:
|
|
||||||
oa = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id
|
|
||||||
if not oa:
|
|
||||||
oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
|
|
||||||
if oa:
|
if oa:
|
||||||
fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False
|
fpos = fposition_id and fiscal_pool.browse(cr, uid, fposition_id, context=context) or False
|
||||||
a = fiscal_pool.map_account(cr, uid, fpos, oa)
|
a = fiscal_pool.map_account(cr, uid, fpos, oa)
|
||||||
|
|
|
@ -41,19 +41,7 @@ class stock_picking(osv.osv):
|
||||||
group=False, type='out_invoice', context=None):
|
group=False, type='out_invoice', context=None):
|
||||||
'''Return ids of created invoices for the pickings'''
|
'''Return ids of created invoices for the pickings'''
|
||||||
res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
|
res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
|
||||||
if type == 'in_refund':
|
if type in ('in_invoice', 'in_refund'):
|
||||||
for inv in self.pool.get('account.invoice').browse(cr, uid, res, context=context):
|
|
||||||
for ol in inv.invoice_line:
|
|
||||||
if ol.product_id:
|
|
||||||
oa = ol.product_id.property_stock_account_output and ol.product_id.property_stock_account_output.id
|
|
||||||
if not oa:
|
|
||||||
oa = ol.product_id.categ_id.property_stock_account_output_categ and ol.product_id.categ_id.property_stock_account_output_categ.id
|
|
||||||
if oa:
|
|
||||||
fpos = ol.invoice_id.fiscal_position or False
|
|
||||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
|
|
||||||
self.pool.get('account.invoice.line').write(cr, uid, [ol.id], {'account_id': a})
|
|
||||||
|
|
||||||
elif type == 'in_invoice':
|
|
||||||
for inv in self.pool.get('account.invoice').browse(cr, uid, res, context=context):
|
for inv in self.pool.get('account.invoice').browse(cr, uid, res, context=context):
|
||||||
for ol in inv.invoice_line:
|
for ol in inv.invoice_line:
|
||||||
if ol.product_id:
|
if ol.product_id:
|
||||||
|
|
Loading…
Reference in New Issue