Permalink
Browse files

[FIX]stock: added related field for display only related categories

  • Loading branch information...
pka-odoo committed Sep 19, 2018
1 parent 33051bd commit a3c5bd368c1a76c49eb618509c4c3b9e8a96aecd
Showing with 3 additions and 1 deletion.
  1. +1 −0 addons/stock/models/stock_move.py
  2. +2 −1 addons/stock/views/stock_picking_views.xml
@@ -62,6 +62,7 @@ def _default_group_id(self):
"backorder. Changing this quantity on assigned moves affects "
"the product reservation, and should be done with care.")
product_uom = fields.Many2one('uom.uom', 'Unit of Measure', required=True)
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id', store=False)
# TDE FIXME: make it stored, otherwise group will not work
product_tmpl_id = fields.Many2one(
'product.template', 'Product Template',
@@ -303,13 +303,14 @@
<field name="additional" invisible="1"/>
<field name="has_move_lines" invisible="1"/>
<field name="is_locked" invisible="1"/>
<field name="product_uom_category_id" invisible="1"/>
<field name="product_id" required="1" attrs="{'readonly': ['|', '&amp;', ('state', '!=', 'draft'), ('additional', '=', False), ('has_move_lines', '=', True)]}"/>
<field name="is_initial_demand_editable" invisible="1"/>
<field name="is_quantity_done_editable" invisible="1"/>
<field name="product_uom_qty" string="Initial Demand" attrs="{'column_invisible': ['&amp;',('parent.immediate_transfer', '=', True), ('parent.is_locked', '=', True)], 'readonly': [('is_initial_demand_editable', '=', False)]}"/>
<field name="reserved_availability" string="Reserved" attrs="{'column_invisible': (['|','&amp;', ('parent.state','=', 'done'), ('parent.picking_type_code', '=', 'incoming'),'&amp;',('parent.immediate_transfer', '=', True), ('parent.is_locked', '=', True)])}"/>
<field name="quantity_done" string="Done" attrs="{'readonly': [('is_quantity_done_editable', '=', False)]}"/>
<field name="product_uom" attrs="{'readonly': [('state', '!=', 'draft'), ('additional', '=', False)]}" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="uom.group_uom"/>
<field name="product_uom" domain="[('category_id', '=', product_uom_category_id)]" attrs="{'readonly': [('state', '!=', 'draft'), ('additional', '=', False)]}" options="{'no_open': True, 'no_create': True}" string="Unit of Measure" groups="uom.group_uom"/>
<button name="action_show_details" string="Register lots, packs, location" type="object" icon="fa-list" attrs="{'invisible': [('show_details_visible', '=', False)]}" options='{"warn": true}'/>
</tree>
</field>

0 comments on commit a3c5bd3

Please sign in to comment.