[FIX] stock_available_mrp: remove duplicate button + fix calculation of immediately usable qty

This commit is contained in:
Timon Tschanz
2018-10-01 17:24:34 +02:00
committed by Florian da Costa
parent cd5c206d2e
commit 85883c4ab0
3 changed files with 1 additions and 29 deletions

View File

@@ -11,9 +11,6 @@
'stock_available', 'stock_available',
'mrp' 'mrp'
], ],
'data': [
'views/product_template_view.xml',
],
'demo': [ 'demo': [
'demo/mrp_data.xml', 'demo/mrp_data.xml',
], ],

View File

@@ -13,5 +13,5 @@ class ProductTemplate(models.Model):
res = super(ProductTemplate, self)._compute_available_quantities_dict() res = super(ProductTemplate, self)._compute_available_quantities_dict()
for template in self.filtered('bom_ids'): for template in self.filtered('bom_ids'):
res[template.id]['immediately_usable_qty'] =\ res[template.id]['immediately_usable_qty'] =\
res[template.id]['potential_qty'] template.virtual_available + res[template.id]['potential_qty']
return res return res

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Add the quantity available to promise in the product form -->
<record id="view_product_form_potential_qty" model="ir.ui.view">
<field name="name">Potential quantity on product form</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock_available.view_stock_available_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='immediately_usable_qty']/ancestor::button" position="after">
<button type="action" name="%(stock.product_open_quants)d"
attrs="{'invisible':[('type', '!=', 'product')]}"
class="oe_stat_button" icon="fa-building-o">
<div class="o_form_field o_stat_info">
<field name="potential_qty"
widget="statinfo" nolabel="1"/>
<span class="o_stat_text">Potential</span>
</div>
</button>
</xpath>
</data>
</field>
</record>
</odoo>