diff options
| author | Robot Odoo <xmo+roboto@odoo.com> | 2019-08-26 13:20:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-26 13:20:27 +0200 |
| commit | ff52295c74fc0c31adbe2d990c2a76f84f885876 (patch) | |
| tree | 91be281367327c59407f6f4b9dbe79fe5d6997c7 | |
| parent | 9fc78879083e87aba2a08a8d86890796cda965c7 (diff) | |
| parent | 2f2ac551423ba5c746b7fedf0971a4ea25a04ab3 (diff) | |
[IMP] stock and mrp : Usability improvements
**Description of the issue/feature this PR addresses**:
- Task: https://www.odoo.com/web#id=1943397&action=333&active_id=131&model=project.task&view_type=form&menu_id=4720
- Pad: https://pad.odoo.com/p/r.018c7fbae8a5a0757b9b1cc5ce2b1d01
**Description:**
- Removed "Assembly station 1" from everywhere and replaced it with "Assemmbly Line 1". Renamed "Assembly station 2" to "Assembly Line 2".
- operations field on BOM will be hidden when advanced routes are not active.
- Hide sequence field in form view in BOM and added a widget handle in list view.
- Hide field "Manufacturing readiness" in MO when WO aren't active.
- Added a domain in PLM in Lot/Serial Numbers to show only variants of the product.
- Removed red and green colors from Traceability Report.
- Renamed "Cost" to "Value" on products.
- Changed tooltip of "weight for shipping" in shipping information in inventory.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
closes odoo/odoo#31594
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
| -rw-r--r-- | addons/mrp/data/mrp_demo.xml | 23 | ||||
| -rw-r--r-- | addons/mrp/views/mrp_bom_views.xml | 5 | ||||
| -rw-r--r-- | addons/stock/models/product.py | 8 | ||||
| -rw-r--r-- | addons/stock/models/stock_production_lot.py | 9 | ||||
| -rw-r--r-- | addons/stock/static/src/xml/stock_traceability_report_line.xml | 8 | ||||
| -rw-r--r-- | addons/stock/views/report_stock_traceability.xml | 5 | ||||
| -rw-r--r-- | addons/stock/views/stock_production_lot_views.xml | 4 |
7 files changed, 24 insertions, 38 deletions
diff --git a/addons/mrp/data/mrp_demo.xml b/addons/mrp/data/mrp_demo.xml index 5c9311f332e..d488281865a 100644 --- a/addons/mrp/data/mrp_demo.xml +++ b/addons/mrp/data/mrp_demo.xml @@ -13,15 +13,6 @@ <!-- Resource: mrp.workcenter --> - <record id="mrp_workcenter_0" model="mrp.workcenter"> - <field name="name">Assembly Station 1</field> - <field name="resource_calendar_id" ref="resource.resource_calendar_std"/> - <field name="capacity">5</field> - <field name="time_start">10</field> - <field name="time_stop">8</field> - <field name="time_efficiency">87</field> - </record> - <record id="mrp_workcenter_3" model="mrp.workcenter"> <field name="name">Assembly Line 1</field> <field name="resource_calendar_id" ref="resource.resource_calendar_std"/> @@ -33,7 +24,7 @@ </record> <record id="mrp_workcenter_2" model="mrp.workcenter"> - <field name="name">Assemble Station 2</field> + <field name="name">Assembly Line 2</field> <field name="resource_calendar_id" ref="resource.resource_calendar_std"/> </record> @@ -62,7 +53,7 @@ <record id="mrp_routing_workcenter_0" model="mrp.routing.workcenter"> <field name="routing_id" ref="mrp_routing_0"/> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="name">Manual Assembly</field> <field name="time_cycle">60</field> <field name="sequence">5</field> @@ -71,7 +62,7 @@ <record id="mrp_routing_workcenter_1" model="mrp.routing.workcenter"> <field name="routing_id" ref="mrp_routing_1"/> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="name">Long time assembly</field> <field name="time_cycle">180</field> <field name="sequence">15</field> @@ -80,7 +71,7 @@ <record id="mrp_routing_workcenter_3" model="mrp.routing.workcenter"> <field name="routing_id" ref="mrp_routing_1"/> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="name">Testing</field> <field name="time_cycle">60</field> <field name="sequence">10</field> @@ -644,21 +635,21 @@ <!-- OEE --> <record id="mrp_workcenter_efficiency_0" model="mrp.workcenter.productivity"> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="loss_id" ref="block_reason7"/> <field name="date_start" eval="(datetime.now() - relativedelta(days=5)).strftime('%Y-%m-%d %H:%M:%S')"/> <field name="date_end" eval="(datetime.now() - relativedelta(days=2)).strftime('%Y-%m-%d %H:%M:%S')"/> </record> <record id="mrp_workcenter_efficiency_1" model="mrp.workcenter.productivity"> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="loss_id" ref="block_reason0"/> <field name="date_start" eval="(datetime.now() - timedelta(hours=5)).strftime('%Y-%m-%d %H:%M:%S')"/> <field name="date_end" eval="(datetime.now() - timedelta(hours=3)).strftime('%Y-%m-%d %H:%M:%S')"/> </record> <record id="mrp_workcenter_efficiency_2" model="mrp.workcenter.productivity"> - <field name="workcenter_id" ref="mrp_workcenter_0"/> + <field name="workcenter_id" ref="mrp_workcenter_3"/> <field name="loss_id" ref="block_reason1"/> <field name="date_start" eval="(datetime.now() - timedelta(days=5, hours=4)).strftime('%Y-%m-%d %H:%M:%S')"/> <field name="date_end" eval="(datetime.now() - timedelta(days=5, hours=3)).strftime('%Y-%m-%d %H:%M:%S')"/> diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index 7ffb50dde88..c64dbee0ab9 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -100,12 +100,11 @@ <page string="Miscellaneous"> <group> <group> - <field name="sequence"/> + <field name="ready_to_produce" attrs="{'invisible': [('type','!=','normal')]}" string="Manufacturing Readiness" groups="mrp.group_mrp_routings"/> <field name="consumption" attrs="{'invisible': [('type','!=','normal')]}"/> </group> <group> - <field name="ready_to_produce" attrs="{'invisible': [('type','!=','normal')]}" string="Manufacturing Readiness"/> - <field name="picking_type_id" attrs="{'invisible': [('type','!=','normal')]}" string="Operation"/> + <field name="picking_type_id" attrs="{'invisible': [('type','!=','normal')]}" string="Operation" groups="stock.group_adv_location"/> </group> </group> </page> diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index cd838f35c93..0a0c6faf05a 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -471,7 +471,7 @@ class Product(models.Model): self.ensure_one() action = self.env.ref('stock.action_production_lot_form').read()[0] action['domain'] = [('product_id', '=', self.id)] - action['context'] = {'default_product_id': self.id} + action['context'] = {'default_product_id': self.id, 'set_product_readonly': True} return action # Be aware that the exact same function exists in product.template @@ -769,11 +769,11 @@ class ProductTemplate(models.Model): self.ensure_one() action = self.env.ref('stock.action_production_lot_form').read()[0] action['domain'] = [('product_id.product_tmpl_id', '=', self.id)] + action['context'] = {'default_product_tmpl_id': self.id} if self.product_variant_count == 1: - action['context'] = { + action['context'].update({ 'default_product_id': self.product_variant_id.id, - } - + }) return action def action_product_tmpl_forecast_report(self): diff --git a/addons/stock/models/stock_production_lot.py b/addons/stock/models/stock_production_lot.py index 82c50565c39..17f0275c84e 100644 --- a/addons/stock/models/stock_production_lot.py +++ b/addons/stock/models/stock_production_lot.py @@ -3,6 +3,7 @@ from odoo import api, fields, models, _ from odoo.exceptions import UserError +from odoo.osv import expression class ProductionLot(models.Model): @@ -16,7 +17,7 @@ class ProductionLot(models.Model): ref = fields.Char('Internal Reference', help="Internal reference number in case it differs from the manufacturer's lot/serial number") product_id = fields.Many2one( 'product.product', 'Product', - domain=[('type', '=', 'product')], required=True) + domain=lambda self: self._domain_product_id(), required=True) product_uom_id = fields.Many2one( 'uom.uom', 'Unit of Measure', related='product_id.uom_id', store=True, readonly=False) @@ -29,6 +30,12 @@ class ProductionLot(models.Model): ('name_ref_uniq', 'unique (name, product_id)', 'The combination of serial number and product must be unique !'), ] + def _domain_product_id(self): + domain = [('type', '=', 'product')] + if self.env.context.get('default_product_tmpl_id'): + domain = expression.AND([domain, [('product_tmpl_id', '=', self.env.context['default_product_tmpl_id'])]]) + return domain + def _check_create(self): active_picking_id = self.env.context.get('active_picking_id', False) if active_picking_id: diff --git a/addons/stock/static/src/xml/stock_traceability_report_line.xml b/addons/stock/static/src/xml/stock_traceability_report_line.xml index 8db2d344084..fa39b9c3087 100644 --- a/addons/stock/static/src/xml/stock_traceability_report_line.xml +++ b/addons/stock/static/src/xml/stock_traceability_report_line.xml @@ -20,10 +20,6 @@ <t t-set="domainClass" t-value="'o_stock_reports_domain_line_1'"/> </t> - <t t-set="span_color" t-value="'color: #666666;'"/> - <t t-if="l.usage == 'in'"><t t-set="span_color" t-value="'color: #3c763d;'"/></t> - <t t-if="l.usage == 'out'"><t t-set="span_color" t-value="'color: #a94442;'"/></t> - <tr t-att-data-unfold="l.unfoldable" t-att-data-parent_id="l.parent_id" t-att-data-id="l.id" t-att-data-model_id="l.model_id" t-att-data-model="l.model" t-att-class="trclass" t-att-data-lot_name="l.lot_name" t-att-data-lot_id="l.lot_id"> <t t-if="l.unfoldable == true"><t t-set="tdclass" t-value="'o_stock_reports_unfoldable'" /></t> <t t-set="column" t-value="0" /> @@ -47,9 +43,9 @@ </span> </t> <t t-if="l.reference != c and l.lot_name != c"> - <t t-if="typeof c == 'string' || typeof c == 'number'"><span t-att-style="span_color"> + <t t-if="typeof c == 'string' || typeof c == 'number'"> <t t-raw="c"/> - </span></t> + </t> <t t-if="typeof c != 'string' & typeof c != 'number'"><span t-att-style="c[1]"> <t t-raw="c[0]"/> </span></t> diff --git a/addons/stock/views/report_stock_traceability.xml b/addons/stock/views/report_stock_traceability.xml index 2863b3ac2ca..20936403bf0 100644 --- a/addons/stock/views/report_stock_traceability.xml +++ b/addons/stock/views/report_stock_traceability.xml @@ -13,9 +13,6 @@ <tr t-att-data-unfold="a['unfoldable']" t-att-data-parent_id="a['parent_id']" t-att-data-id="a['id']" t-att-data-model_id="a['model_id']" t-att-data-model="a['model']" t-att-data-lot_name="a['lot_name']" t-att-data-lot_id="a['lot_id']" t-att-class="trclass"> <t t-set="tdclass" t-value="''" /> <t t-set="spanclass" t-value="''" /> - <t t-set="span_color" t-value="'color: #666666;'"/> - <t t-if="a['usage'] == 'in'"><t t-set="span_color" t-value="'color: #3c763d;'"/></t> - <t t-if="a['usage'] == 'out'"><t t-set="span_color" t-value="'color: #a94442;'"/></t> <t t-if="a.get('unfoldable')"><t t-set="tdclass" t-value="'o_stock_reports_unfoldable'" /></t> <t t-if="not a.get('unfoldable')"><t t-set="spanclass" t-value="'o_stock_reports_nofoldable'" /></t> <t t-set="column" t-value="0" /> @@ -41,9 +38,7 @@ </span> </t> <t t-else=""> - <span t-att-style="span_color"> <t t-raw="c"/> - </span> </t> </td> </t> diff --git a/addons/stock/views/stock_production_lot_views.xml b/addons/stock/views/stock_production_lot_views.xml index 7caf76f7dde..937cdde3dcf 100644 --- a/addons/stock/views/stock_production_lot_views.xml +++ b/addons/stock/views/stock_production_lot_views.xml @@ -21,9 +21,7 @@ </div> <group name="main_group"> <group> - <field name="product_id" - help="Product this lot/serial number contains. You cannot change it anymore if it has already been moved." - attrs="{'readonly': [('id', '!=', False), ('product_id', '!=', False)]}"/> + <field name="product_id" readonly="context.get('set_product_readonly', False)" force_save="1" help="Product this lot/serial number contains. You cannot change it anymore if it has already been moved."/> <label for="product_qty" attrs="{'invisible': [('display_complete', '=', False)]}"/> <div class="o_row" attrs="{'invisible': [('display_complete', '=', False)]}"> <field name="product_qty"/> |
