[REF] stock_landed_costs usability imp

bzr revid: qdp-launchpad@openerp.com-20140424130846-6348yoos4omernli
This commit is contained in:
Quentin (OpenERP) 2014-04-24 15:08:46 +02:00
parent f5a285267c
commit 5183909ade
2 changed files with 11 additions and 10 deletions

View File

@ -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

View File

@ -86,13 +86,13 @@
</group>
</form>
<tree string="Valuation Adjustments" editable="bottom">
<field name="product_id"/>
<field name="quantity"/>
<field name="weight"/>
<field name="volume"/>
<field name="cost_line_id"/>
<field name="former_cost"/>
<field name="former_cost_per_unit"/>
<field name="cost_line_id" readonly="1"/>
<field name="product_id" readonly="1"/>
<field name="weight" readonly="1"/>
<field name="volume" readonly="1"/>
<field name="quantity" readonly="1"/>
<field name="former_cost_per_unit" readonly="1"/>
<field name="former_cost" readonly="1"/>
<field name="additional_landed_cost"/>
</tree>
</field>