summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-17 10:01:31 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-17 10:01:31 +0200
commitf02cafa014abfa3b46c100cb2b13d5cfb90249f9 (patch)
tree5c2fc77423838212d5723c0b455539071ff7d366
parent6d04faf6c24e884ed8e8b49620321acbbea65d13 (diff)
[FIX] stock_account: define variable in right function
-rw-r--r--addons/stock_account/models/stock.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py
index 88a87e5e380..60f534bf298 100644
--- a/addons/stock_account/models/stock.py
+++ b/addons/stock_account/models/stock.py
@@ -514,11 +514,6 @@ class StockMove(models.Model):
else:
valuation_amount = cost
- if self._context.get('forced_ref'):
- ref = self._context['forced_ref']
- else:
- ref = self.picking_id.name
-
# the standard_price of the product may be in another decimal precision, or not compatible with the coinage of
# the company currency... so we need to use round() before creating the accounting entries.
debit_value = self.company_id.currency_id.round(valuation_amount)
@@ -549,6 +544,11 @@ class StockMove(models.Model):
# This method returns a dictonary to provide an easy extension hook to modify the valuation lines (see purchase for an example)
self.ensure_one()
+ if self._context.get('forced_ref'):
+ ref = self._context['forced_ref']
+ else:
+ ref = self.picking_id.name
+
debit_line_vals = {
'name': self.name,
'product_id': self.product_id.id,