summaryrefslogtreecommitdiff
path: root/addons/stock/views/stock_scrap_views.xml
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2019-09-04 12:37:28 +0000
committersvs-odoo <svs@odoo.com>2019-09-05 10:18:06 +0000
commit863afa2ab0e1ce5d474e1cdaa84cc5651ebb8042 (patch)
tree4dac662af60725ffd40ae432e4efd0c27931d59b /addons/stock/views/stock_scrap_views.xml
parentf04141093c5aa824736fc2f6f5fe352d83fd5a74 (diff)
[IMP] stock: better use of scrap form
When creating a scrap, the `scrap_qty` is fixed to 1 in case the product is tracked by serial number. Also, pass the company and product ids in case user creates a new lot number from the scrap form.
Diffstat (limited to 'addons/stock/views/stock_scrap_views.xml')
-rw-r--r--addons/stock/views/stock_scrap_views.xml7
1 files changed, 5 insertions, 2 deletions
diff --git a/addons/stock/views/stock_scrap_views.xml b/addons/stock/views/stock_scrap_views.xml
index 311149dc43c..6c88a0988ea 100644
--- a/addons/stock/views/stock_scrap_views.xml
+++ b/addons/stock/views/stock_scrap_views.xml
@@ -157,7 +157,8 @@
<field name="product_id" options="{'no_create': True}" domain="[('id', 'in', context.get('product_ids', []))]"/>
<label for="scrap_qty"/>
<div class="o_row">
- <field name="scrap_qty"/>
+ <field name="scrap_qty"
+ attrs="{'readonly': [('tracking', '=', 'serial')]}"/>
<field name="product_uom_category_id" invisible="1"/>
<field name="product_uom_id" groups="uom.group_uom"/>
</div>
@@ -165,7 +166,9 @@
<group>
<field name="picking_id" invisible="1"/>
<field name="tracking" invisible="1"/>
- <field name="lot_id" attrs="{'invisible': ['|',('product_id', '=', False),('tracking', '=', 'none')], 'required': [('tracking', '!=', 'none')]}" groups="stock.group_production_lot"/>
+ <field name="lot_id" groups="stock.group_production_lot"
+ context="{'default_company_id': company_id, 'default_product_id': product_id}"
+ attrs="{'invisible': ['|',('product_id', '=', False),('tracking', '=', 'none')], 'required': [('tracking', '!=', 'none')]}"/>
<field name="package_id" groups="stock.group_tracking_lot"/>
<field name="owner_id" groups="stock.group_tracking_owner"/>
<field name="company_id" invisible="1"/>