[REF] stock_landed_costs usability imp
bzr revid: qdp-launchpad@openerp.com-20140424130846-6348yoos4omernli
This commit is contained in:
parent
f5a285267c
commit
5183909ade
|
@ -167,13 +167,14 @@ class stock_landed_cost(osv.osv):
|
||||||
for cost in self.browse(cr, uid, ids, context=context):
|
for cost in self.browse(cr, uid, ids, context=context):
|
||||||
if not cost.valuation_adjustment_lines:
|
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)
|
move_id = self._create_account_move(cr, uid, cost, context=context)
|
||||||
quant_dict = {}
|
quant_dict = {}
|
||||||
for line in cost.valuation_adjustment_lines:
|
for line in cost.valuation_adjustment_lines:
|
||||||
|
if not line.move_id:
|
||||||
|
continue
|
||||||
per_unit = line.final_cost / line.quantity
|
per_unit = line.final_cost / line.quantity
|
||||||
diff = per_unit - line.former_cost_per_unit
|
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:
|
for quant in quants:
|
||||||
if quant.id not in quant_dict:
|
if quant.id not in quant_dict:
|
||||||
quant_dict[quant.id] = quant.cost + diff
|
quant_dict[quant.id] = quant.cost + diff
|
||||||
|
|
|
@ -86,13 +86,13 @@
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
<tree string="Valuation Adjustments" editable="bottom">
|
<tree string="Valuation Adjustments" editable="bottom">
|
||||||
<field name="product_id"/>
|
<field name="cost_line_id" readonly="1"/>
|
||||||
<field name="quantity"/>
|
<field name="product_id" readonly="1"/>
|
||||||
<field name="weight"/>
|
<field name="weight" readonly="1"/>
|
||||||
<field name="volume"/>
|
<field name="volume" readonly="1"/>
|
||||||
<field name="cost_line_id"/>
|
<field name="quantity" readonly="1"/>
|
||||||
<field name="former_cost"/>
|
<field name="former_cost_per_unit" readonly="1"/>
|
||||||
<field name="former_cost_per_unit"/>
|
<field name="former_cost" readonly="1"/>
|
||||||
<field name="additional_landed_cost"/>
|
<field name="additional_landed_cost"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
|
Loading…
Reference in New Issue