From bcf1e38af8cdd800e5ef516895a83e3d64af83e8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 21 Nov 2016 12:43:02 +0100 Subject: [PATCH] [FIX] stock_account: refund supplier invoice When Anglo-Saxon accounting is activated: - Use two different accounts for Input/Output for Stock Valuation - Create a vendor bill ==> by default, the Input Account for Stock Valuation is used - Validate the vendor bill - Refund the vendor bill When the refund is created, the Output Account for Stock Valuation is used. There is actually no obvious reason to use this account instead of the account originally used. opw-691571 --- addons/stock_account/stock_account.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index c220af80a5f..926622fc386 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -106,28 +106,6 @@ class account_invoice(osv.osv): ] return [] - def _prepare_refund(self, cr, uid, invoice, date_invoice=None, date=None, description=None, journal_id=None, context=None): - invoice_data = super(account_invoice, self)._prepare_refund(cr, uid, invoice, date_invoice, date, - description, journal_id, context=context) - #for anglo-saxon accounting - if invoice.company_id.anglo_saxon_accounting and invoice.type == 'in_invoice': - fiscal_position = self.pool.get('account.fiscal.position') - for dummy, dummy, line_dict in invoice_data['invoice_line_ids']: - if line_dict.get('product_id'): - product = self.pool.get('product.product').browse(cr, uid, line_dict['product_id'], context=context) - counterpart_acct_id = product.property_stock_account_output and \ - product.property_stock_account_output.id - if not counterpart_acct_id: - counterpart_acct_id = product.categ_id.property_stock_account_output_categ_id and \ - product.categ_id.property_stock_account_output_categ_id.id - if counterpart_acct_id: - fpos = invoice.fiscal_position_id or False - line_dict['account_id'] = fiscal_position.map_account(cr, uid, - fpos, - counterpart_acct_id) - return invoice_data - - #---------------------------------------------------------- # Stock Location #----------------------------------------------------------