diff options
| author | Valerie Pirenne <vpi@odoo.com> | 2015-06-17 20:00:24 +0530 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2015-07-02 13:43:21 +0200 |
| commit | a314fa0de22067cb1cbcdb01db0badef4eb6be02 (patch) | |
| tree | 7e9ecaa2bf084fb10f26dc15e4b5f9c5a9fa9d98 | |
| parent | 9bd8c00b01e15efde20233787bf5084d0c268482 (diff) | |
[IMP] product_extended: more computed price informations in compute price wizard
| -rw-r--r-- | addons/product_extended/product_extended.py | 2 | ||||
| -rw-r--r-- | addons/product_extended/product_extended_view.xml | 2 | ||||
| -rw-r--r-- | addons/product_extended/wizard/wizard_price.py | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/addons/product_extended/product_extended.py b/addons/product_extended/product_extended.py index 29b660fce6e..ce31ef2c035 100644 --- a/addons/product_extended/product_extended.py +++ b/addons/product_extended/product_extended.py @@ -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') diff --git a/addons/product_extended/product_extended_view.xml b/addons/product_extended/product_extended_view.xml index eebf8c4f2f3..27bd7443fe4 100644 --- a/addons/product_extended/product_extended_view.xml +++ b/addons/product_extended/product_extended_view.xml @@ -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"/> diff --git a/addons/product_extended/wizard/wizard_price.py b/addons/product_extended/wizard/wizard_price.py index 72e6bee7418..8bfd6dc03c6 100644 --- a/addons/product_extended/wizard/wizard_price.py +++ b/addons/product_extended/wizard/wizard_price.py @@ -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): |
