From 5183909ade4b42b84c214356a59a6911513419bc Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 24 Apr 2014 15:08:46 +0200 Subject: [PATCH] [REF] stock_landed_costs usability imp bzr revid: qdp-launchpad@openerp.com-20140424130846-6348yoos4omernli --- addons/stock_landed_costs/stock_landed_costs.py | 7 ++++--- .../stock_landed_costs/stock_landed_costs_view.xml | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/stock_landed_costs/stock_landed_costs.py b/addons/stock_landed_costs/stock_landed_costs.py index 526f458d824..f0c7d5d1102 100644 --- a/addons/stock_landed_costs/stock_landed_costs.py +++ b/addons/stock_landed_costs/stock_landed_costs.py @@ -166,14 +166,15 @@ class stock_landed_cost(osv.osv): quant_obj = self.pool.get('stock.quant') for cost in self.browse(cr, uid, ids, context=context): if not cost.valuation_adjustment_lines: - raise osv.except_osv(_('Error!'),_('You cannot validate a landed cost which has no valuation line.')) - + raise osv.except_osv(_('Error!'), _('You cannot validate a landed cost which has no valuation line.')) move_id = self._create_account_move(cr, uid, cost, context=context) quant_dict = {} for line in cost.valuation_adjustment_lines: + if not line.move_id: + continue per_unit = line.final_cost / line.quantity diff = per_unit - line.former_cost_per_unit - quants = [quant for quant in line.move_id.quant_ids if line.move_id] + quants = [quant for quant in line.move_id.quant_ids] for quant in quants: if quant.id not in quant_dict: quant_dict[quant.id] = quant.cost + diff diff --git a/addons/stock_landed_costs/stock_landed_costs_view.xml b/addons/stock_landed_costs/stock_landed_costs_view.xml index b470754bc7e..77cb030dd7c 100644 --- a/addons/stock_landed_costs/stock_landed_costs_view.xml +++ b/addons/stock_landed_costs/stock_landed_costs_view.xml @@ -86,13 +86,13 @@ - - - - - - - + + + + + + +