[IMP] product_extended: more computed price informations in compute price wizard

This commit is contained in:
Valerie Pirenne
2015-07-02 13:43:21 +02:00
committed by David Monjoie
parent 9bd8c00b01
commit a314fa0de2
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ class product_template(osv.osv):
ids = product_ids
model = 'product.product'
else:
ids = template_ids
ids = template_ids or []
model = 'product.template'
for prod_id in ids:
bom_obj = self.pool.get('mrp.bom')
@@ -9,7 +9,7 @@
<field name="arch" type="xml">
<field name="standard_price" position="after">
<button name="%(action_view_compute_price_wizard)d" string="⇒ Update"
type="action" attrs="{'invisible': [('cost_method', '!=', 'standard')]}"
type="action" attrs="{'invisible': ['|', ('cost_method', '!=', 'standard'), ('bom_count', '=', 0)]}"
help="Compute the price of the product using products and operations of related bill of materials, for manufactured products only."
class="oe_link"
groups="stock_account.group_inventory_valuation"/>
@@ -22,7 +22,11 @@ class wizard_price(osv.osv):
context = {}
rec_id = context and context.get('active_id', False)
assert rec_id, _('Active ID is not set in Context.')
res['info_field'] = str(product_pool.compute_price(cr, uid, [], template_ids=[product_obj.id], test=True, context=context))
computed_price = product_pool.compute_price(cr, uid, [], template_ids=[product_obj.id], test=True, context=context)
if product_obj.id in computed_price:
res['info_field'] = "%s: %s" % (product_obj.name, computed_price[product_obj.id])
else:
res['info_field'] = ""
return res
def compute_from_bom(self, cr, uid, ids, context=None):