Skip to content
Permalink
Browse files

[IMP] mrp,stock: usability improvement

- change empty list message on MO
- hide attachment icon on BOM in edit mode
- hide UNLOCK button on MO in draft state
- show material availability field only in list view
- change position of cancel button on MO in confirmd state
- if enough components available to make at least one finished product then produce button on MO should become green
- the update button should stay close to the product on BOM
- hide Productivity Losses and Working Times in submenu
- change filter name 'Waiting for Material' to 'Waiting for Component' and 'Material Available' to 'Component Available'
- remove barcode field from operation type(picking type) form and add it from stock_barcode

Related Task- 1949618
  • Loading branch information...
jip-odoo committed Apr 10, 2019
1 parent 6af61e8 commit f7b9dfa0ee3a75a753be61cbaaeb700ebc557f01
@@ -200,6 +200,13 @@ def _get_default_location_dest_id(self):
production_location_id = fields.Many2one('stock.location', "Production Location", related='product_id.property_stock_production', readonly=False)
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Picking associated to this manufacturing order')
delivery_count = fields.Integer(string='Delivery Orders', compute='_compute_picking_ids')
is_ready_produce = fields.Boolean(compute='_compute_is_ready_produce')

@api.depends('move_raw_ids', 'move_raw_ids.reserved_availability')
def _compute_is_ready_produce(self):
for order in self:
if order.state not in ('draft', 'done', 'cancel'):
order.is_ready_produce = all(move.bom_line_id.product_qty <= move.reserved_availability for move in order.move_raw_ids)

@api.depends('procurement_group_id')
def _compute_picking_ids(self):
@@ -25,6 +25,10 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>

<record id="make_invisible" model="res.groups">
<field name="name">Invisible</field>
</record>

</data>
<data noupdate="1">
<record id="base.default_user" model="res.users">
@@ -57,8 +57,8 @@
<tree string="Components" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="product_id" context="{'default_type': 'product'}"/>
<button name="action_see_attachments" type="object" icon="fa-files-o" aria-label="attachment" title="attachment"
class="float-right"/>
<button name="action_see_attachments" type="object" icon="fa-files-o" aria-label="Product Attachments" title="Product Attachments"
class="float-right oe_read_only"/>
<field name="attachments_count" class="text-left"
string=" "/>
<field name="product_qty"/>
@@ -40,17 +40,18 @@
<button name="action_assign" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('draft', 'done', 'cancel')), ('reservation_state', '=', 'assigned')]}" string="Check availability" type="object" class="oe_highlight"/>
<button name="button_plan" attrs="{'invisible': ['|', ('state', 'not in', ('confirmed', 'planned')), '|', ('routing_id', '=', False), '|', ('date_planned_start_wo', '!=', False), ('date_planned_finished_wo', '!=', False)]}" type="object" string="Plan" class="oe_highlight"/>
<button name="button_unplan" type="object" string="Unplan" attrs="{'invisible': ['|', '|', ('state', '!=', 'planned'), ('date_planned_start_wo', '=', False), ('date_planned_finished_wo', '=', False)]}"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_locked', '=', False), ('reservation_state', '!=', 'assigned'), ('routing_id', '!=', False)]}" string="Produce" type="object" class="oe_highlight"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_locked', '=', False), ('reservation_state', 'not in', ('confirmed', 'waiting')), ('routing_id', '!=', False)]}" string="Produce" type="object"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_ready_produce', '=', False), ('is_locked', '=', False), ('routing_id', '!=', False)]}" string="Produce" type="object" class="oe_highlight"/>
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', '|', ('state', '=', 'to_close'), ('is_ready_produce', '=', True), ('is_locked', '=', False), ('reservation_state', 'not in', ('confirmed', 'waiting')), ('routing_id', '!=', False)]}" string="Produce" type="object"/>
<button name="post_inventory" string="Post Inventory" type="object" attrs="{'invisible': [('post_visible', '=', False)]}" groups="base.group_no_one"/>
<button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('done','cancel'))]}"/>
<button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': ['|', ('state', 'in', ('cancel', 'draft')), ('is_locked', '=', False)]}"/>
<button name="button_unreserve" type="object" string="Unreserve" attrs="{'invisible': [('unreserve_visible', '=', False)]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,assigned,done"/>
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', '|', ('state', '=', 'cancel'), ('id', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="Unlock the manufacturing order to correct what has been consumed or produced."/>
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', '|', ('state', 'in', ('cancel', 'draft')), ('id', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="Unlock the manufacturing order to correct what has been consumed or produced."/>
<button name="action_toggle_is_locked" attrs="{'invisible': [('is_locked', '=', True)]}" string="Lock" class="oe_highlight" groups="mrp.group_mrp_manager" type="object"/>
<button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('done','cancel'))]}"/>
</header>
<sheet>
<field name="is_ready_produce" invisible="1"/>
<field name="is_locked" invisible="1"/>
<field name="post_visible" invisible="1"/>
<field name="unreserve_visible" invisible="1"/>
@@ -83,12 +84,14 @@
<field name="product_id" attrs="{'readonly': [('state', '!=', 'draft')]}" domain="[('bom_ids', '!=', False), ('bom_ids.active', '=', True), ('bom_ids.type', '=', 'normal')]"/>
<field name="product_tmpl_id" invisible="1"/>
<label for="product_qty"/>
<div class="o_row">
<field name="product_qty" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" force_save="1" groups="uom.group_uom" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<button type="action"
name="%(mrp.action_change_production_qty)d"
string="Update" class="oe_link" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}"/>
<div class="o_row no-gutters d-flex">
<div class="col">
<field name="product_qty" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" force_save="1" groups="uom.group_uom" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<button type="action"
name="%(mrp.action_change_production_qty)d"
string="Update" class="oe_link" attrs="{'invisible': ['|', ('state', 'in', ('draft', 'done','cancel')), ('id', '=', False)]}"/>
</div>
</div>
<field name="bom_id"
domain="['&amp;', '|',
@@ -169,7 +172,7 @@
</group>
</group>
<group>
<field name="reservation_state"/>
<field name="reservation_state" invisible="1"/>
</group>
</page>
</notebook>
@@ -274,8 +277,8 @@
<filter string="Done" name="filter_done" domain="[('state', '=', 'done')]"/>
<filter string="Cancelled" name="filter_cancel" domain="[('state', '=', 'cancel')]"/>
<separator/>
<filter string="Waiting for Material" name="waiting" domain="[('reservation_state', 'in', ('waiting', 'confirmed'))]"/>
<filter string="Material Available" name="filter_ready" domain="[('reservation_state', '=', 'assigned')]"/>
<filter string="Waiting for Component" name="waiting" domain="[('reservation_state', 'in', ('waiting', 'confirmed'))]"/>
<filter string="Component Available" name="filter_ready" domain="[('reservation_state', '=', 'assigned')]"/>
<separator/>
<filter string="Late" domain="['&amp;', ('date_planned_start', '&lt;', current_date), ('state', '=', 'confirmed')]"
name="late" help="Production started late"/>
@@ -318,7 +321,7 @@
<field name="domain">[('picking_type_id.active', '=', True)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new manufacturing order
Consume components and build finished products using bills of materials
</p>
</field>
</record>
@@ -37,6 +37,7 @@

<menuitem id="menu_view_resource_calendar_search_mrp"
action="resource.action_resource_calendar_form"
groups="make_invisible"
parent="menu_mrp_configuration"
sequence="110"/>

@@ -526,7 +526,7 @@

<menuitem id="menu_mrp_workcenter_productivity_loss"
action="mrp_workcenter_productivity_loss_action"
groups="group_mrp_routings"
groups="make_invisible"
sequence="20"
parent="menu_mrp_configuration"/>

@@ -45,7 +45,6 @@
<field name="name"/>
<field name="sequence_id"/>
<field name="warehouse_id" groups="stock.group_stock_multi_warehouses"/>
<field name="barcode"/>
</group>
<group>
<field name="code"/>

0 comments on commit f7b9dfa

Please sign in to comment.
You can’t perform that action at this time.