From a6b1000899a70bd8546883720a1cc30dd596d110 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 28 Sep 2011 11:51:11 +0530 Subject: [PATCH 1/4] [FIX] Stock:Rename string "Stock Variation Account" to "Stock Valuation Account" lp bug: https://launchpad.net/bugs/777522 fixed bzr revid: aag@tinyerp.com-20110928062111-7efdiemj2e5qsddw --- addons/stock/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index b6fa45c7836..f67ba726816 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -452,7 +452,7 @@ class product_category(osv.osv): 'property_stock_variation': fields.property('account.account', type='many2one', relation='account.account', - string="Stock Variation Account", + string="Stock Valuation Account", view_load=True, help="When real-time inventory valuation is enabled on a product, this account will hold the current value of the products.",), } From 27fe53e940a9b7577ecec8f188ee1f5b81af07e7 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 10 Oct 2011 11:49:22 +0530 Subject: [PATCH 2/4] [Fix] Stock:Change field name property_stock_variation into property_stock_valuation_account_id lp bug: https://launchpad.net/bugs/777522 fixed bzr revid: aag@tinyerp.com-20111010061922-630tnm331s73ze7g --- addons/stock/product.py | 9 ++++----- addons/stock/product_view.xml | 2 +- addons/stock/stock_demo.xml | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index f67ba726816..95fa850e521 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -44,13 +44,12 @@ class product_product(osv.osv): stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False - account_variation = product_obj.categ_id.property_stock_variation and product_obj.categ_id.property_stock_variation.id or False - + account_variation = product_obj.categ_id.property_stock_valuation_account_id and product_obj.categ_id.property_stock_valuation_account_id.id or False return { 'stock_account_input': stock_input_acc, 'stock_account_output': stock_output_acc, 'stock_journal': journal_id, - 'property_stock_variation': account_variation + 'property_stock_valuation_account_id': account_variation } def do_change_standard_price(self, cr, uid, ids, datas, context=None): @@ -71,7 +70,7 @@ class product_product(osv.osv): stock_input_acc = datas.get('stock_input_account', False) journal_id = datas.get('stock_journal', False) product_obj=self.browse(cr, uid, ids, context=context)[0] - account_variation = product_obj.categ_id.property_stock_variation + account_variation = product_obj.categ_id.property_stock_valuation_account_id account_variation_id = account_variation and account_variation.id or False if not account_variation_id: raise osv.except_osv(_('Error!'), _('Variation Account is not specified for Product Category: %s') % (product_obj.categ_id.name)) move_ids = [] @@ -449,7 +448,7 @@ class product_category(osv.osv): type='many2one', relation='account.account', string='Stock Output Account', view_load=True, help='When doing real-time inventory valuation, counterpart Journal Items for all outgoing stock moves will be posted in this account. This is the default value for all products in this category, it can also directly be set on each product.'), - 'property_stock_variation': fields.property('account.account', + 'property_stock_valuation_account_id': fields.property('account.account', type='many2one', relation='account.account', string="Stock Valuation Account", diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index a0059ce60d3..39d155b57d4 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -27,7 +27,7 @@ - + diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index 7bcda8a200e..386a4d60e30 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -260,9 +260,9 @@ - - property_stock_variation - + + property_stock_valuation_account_id + From 78506b24aa3fbef4206c1501f0a998559a74bf7e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 10 Oct 2011 12:13:37 +0530 Subject: [PATCH 3/4] [IMP] Stock:Rename variable name account_variation to account_valuation bzr revid: aag@tinyerp.com-20111010064337-731biv5udvp45qbj --- addons/stock/product.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index 95fa850e521..5341e80fb09 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -44,12 +44,12 @@ class product_product(osv.osv): stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False - account_variation = product_obj.categ_id.property_stock_valuation_account_id and product_obj.categ_id.property_stock_valuation_account_id.id or False + account_valuation = product_obj.categ_id.property_stock_valuation_account_id and product_obj.categ_id.property_stock_valuation_account_id.id or False return { 'stock_account_input': stock_input_acc, 'stock_account_output': stock_output_acc, 'stock_journal': journal_id, - 'property_stock_valuation_account_id': account_variation + 'property_stock_valuation_account_id': account_valuation } def do_change_standard_price(self, cr, uid, ids, datas, context=None): @@ -70,9 +70,9 @@ class product_product(osv.osv): stock_input_acc = datas.get('stock_input_account', False) journal_id = datas.get('stock_journal', False) product_obj=self.browse(cr, uid, ids, context=context)[0] - account_variation = product_obj.categ_id.property_stock_valuation_account_id - account_variation_id = account_variation and account_variation.id or False - if not account_variation_id: raise osv.except_osv(_('Error!'), _('Variation Account is not specified for Product Category: %s') % (product_obj.categ_id.name)) + account_valuation = product_obj.categ_id.property_stock_valuation_account_id + account_valuation_id = account_valuation and account_valuation.id or False + if not account_valuation_id: raise osv.except_osv(_('Error!'), _('Valuation Account is not specified for Product Category: %s') % (product_obj.categ_id.name)) move_ids = [] loc_ids = location_obj.search(cr, uid,[('usage','=','internal')]) for rec_id in ids: @@ -131,7 +131,7 @@ class product_product(osv.osv): }) move_line_obj.create(cr, uid, { 'name': product.categ_id.name, - 'account_id': account_variation_id, + 'account_id': account_valuation_id, 'credit': amount_diff, 'move_id': move_id }) @@ -157,7 +157,7 @@ class product_product(osv.osv): }) move_line_obj.create(cr, uid, { 'name': product.categ_id.name, - 'account_id': account_variation_id, + 'account_id': account_valuation_id, 'debit': amount_diff, 'move_id': move_id }) From 38ed934c8ae21dbe19b9ed6779ce3b0e0dda5334 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 10 Oct 2011 17:03:46 +0530 Subject: [PATCH 4/4] [IMP] Stock:Change field name property_stock_variation into property_stock_valuation_account_id bzr revid: aag@tinyerp.com-20111010113346-vopj07xuehwpm1u8 --- addons/stock/i18n/stock.pot | 6 +++--- addons/stock/stock.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index b09b739c04e..c9a9f0d78bb 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -1978,8 +1978,8 @@ msgid "Future Qty" msgstr "" #. module: stock -#: field:product.category,property_stock_variation:0 -msgid "Stock Variation Account" +#: field:product.category,property_stock_valuation_account_id:0 +msgid "Stock Valuation Account" msgstr "" #. module: stock @@ -2036,7 +2036,7 @@ msgid "Location where the system will stock the finished products." msgstr "" #. module: stock -#: help:product.category,property_stock_variation:0 +#: help:product.category,property_stock_valuation_account_id:0 msgid "When real-time inventory valuation is enabled on a product, this account will hold the current value of the products." msgstr "" diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d9debe6641b..ad40dff00e8 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2033,14 +2033,14 @@ class stock_move(osv.osv): else: acc_dest = accounts['stock_account_output'] - acc_variation = accounts.get('property_stock_variation', False) + acc_valuation = accounts.get('property_stock_valuation_account_id', False) journal_id = accounts['stock_journal'] - if acc_dest == acc_variation: - raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account defined on this product and Variant account on category of this product are same.')) + if acc_dest == acc_valuation: + raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account defined on this product and Valuation account on category of this product are same.')) - if acc_src == acc_variation: - raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account defined on this product and Variant account on category of this product are same.')) + if acc_src == acc_valuation: + raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account defined on this product and Valuation account on category of this product are same.')) if not acc_src: raise osv.except_osv(_('Error!'), _('There is no stock input account defined for this product or its category: "%s" (id: %d)') % \ @@ -2051,10 +2051,10 @@ class stock_move(osv.osv): if not journal_id: raise osv.except_osv(_('Error!'), _('There is no journal defined on the product category: "%s" (id: %d)') % \ (move.product_id.categ_id.name, move.product_id.categ_id.id,)) - if not acc_variation: - raise osv.except_osv(_('Error!'), _('There is no inventory variation account defined on the product category: "%s" (id: %d)') % \ + if not acc_valuation: + raise osv.except_osv(_('Error!'), _('There is no inventory Valuation account defined on the product category: "%s" (id: %d)') % \ (move.product_id.categ_id.name, move.product_id.categ_id.id,)) - return journal_id, acc_src, acc_dest, acc_variation + return journal_id, acc_src, acc_dest, acc_valuation def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None): """ @@ -2104,17 +2104,17 @@ class stock_move(osv.osv): if move.location_id.company_id \ and (move.location_id.usage == 'internal' and move.location_dest_id.usage != 'internal'\ or move.location_id.company_id != move.location_dest_id.company_id): - journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx) + journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, src_company_ctx) reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx) - account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_variation, acc_dest, reference_amount, reference_currency_id, context))] + account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_valuation, acc_dest, reference_amount, reference_currency_id, context))] # Incoming moves (or cross-company input part) if move.location_dest_id.company_id \ and (move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal'\ or move.location_id.company_id != move.location_dest_id.company_id): - journal_id, acc_src, acc_dest, acc_variation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx) + journal_id, acc_src, acc_dest, acc_valuation = self._get_accounting_data_for_valuation(cr, uid, move, dest_company_ctx) reference_amount, reference_currency_id = self._get_reference_accounting_values_for_valuation(cr, uid, move, src_company_ctx) - account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_src, acc_variation, reference_amount, reference_currency_id, context))] + account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_src, acc_valuation, reference_amount, reference_currency_id, context))] move_obj = self.pool.get('account.move') for j_id, move_lines in account_moves: