From 93a33e603a3e3c02656b9aa59396f204245826e0 Mon Sep 17 00:00:00 2001 From: Haresh Shyara Date: Mon, 8 Oct 2018 10:54:33 +0000 Subject: [PATCH 1/2] [IMP] stock: removed require on responsible field - when responsible field is empty on the product then next activity should be assigned to the system admin. Task ID : 1891230 --- addons/product_expiry/models/production_lot.py | 4 ++-- addons/stock/models/product.py | 2 +- addons/stock/models/stock_rule.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/product_expiry/models/production_lot.py b/addons/product_expiry/models/production_lot.py index 5ddaf4a5f60..bb40157dc76 100644 --- a/addons/product_expiry/models/production_lot.py +++ b/addons/product_expiry/models/production_lot.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import datetime -from odoo import api, fields, models, _ +from odoo import api, fields, models, SUPERUSER_ID, _ class StockProductionLot(models.Model): @@ -81,7 +81,7 @@ class StockProductionLot(models.Model): ('mail_activity_type_id','=', mail_activity_type)])) for lot in lots: lot.activity_schedule('product_expiry.mail_activity_type_alert_date_reached', - user_id=lot.product_id.responsible_id.id, note=_("The alert date has been reached for this lot/serial number") + user_id=lot.product_id.responsible_id.id or SUPERUSER_ID, note=_("The alert date has been reached for this lot/serial number") ) class ProcurementGroup(models.Model): diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 2b3f9af2baa..7963894db71 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -402,7 +402,7 @@ class ProductTemplate(models.Model): _inherit = 'product.template' responsible_id = fields.Many2one( - 'res.users', string='Responsible', default=lambda self: self.env.uid, required=True, + 'res.users', string='Responsible', help="This user will be responsible of the next activities related to logistic operations for this product.") type = fields.Selection(selection_add=[('product', 'Storable Product')]) property_stock_production = fields.Many2one( diff --git a/addons/stock/models/stock_rule.py b/addons/stock/models/stock_rule.py index 5dc9132834c..21fbf20125c 100644 --- a/addons/stock/models/stock_rule.py +++ b/addons/stock/models/stock_rule.py @@ -7,7 +7,7 @@ from dateutil.relativedelta import relativedelta from odoo.tools.misc import split_every from psycopg2 import OperationalError -from odoo import api, fields, models, registry, _ +from odoo import api, fields, models, registry, SUPERUSER_ID, _ from odoo.osv import expression from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT, float_compare, float_round @@ -245,7 +245,7 @@ class StockRule(models.Model): self.env['mail.activity'].create({ 'activity_type_id': activity_type_id, 'note': note, - 'user_id': product_id.responsible_id.id, + 'user_id': product_id.responsible_id.id or SUPERUSER_ID, 'res_id': product_id.product_tmpl_id.id, 'res_model_id': self.env.ref('product.model_product_template').id, }) From abcfa38f2cfe6fea16a5138638894e6fc8aa5822 Mon Sep 17 00:00:00 2001 From: Haresh Shyara Date: Mon, 26 Nov 2018 09:42:11 +0000 Subject: [PATCH 2/2] [IMP] stock: rename 'Make to Order (MTO)' into 'Replenish on Order (MTO)' --- addons/stock/data/stock_data.xml | 2 +- addons/stock/models/product.py | 2 +- odoo/addons/test_main_flows/static/src/js/tour.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/stock/data/stock_data.xml b/addons/stock/data/stock_data.xml index be5f560d1a1..52ea5baf809 100644 --- a/addons/stock/data/stock_data.xml +++ b/addons/stock/data/stock_data.xml @@ -66,7 +66,7 @@ - Make To Order + Replenish on Order (MTO) 5 diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 7963894db71..2f16867a42c 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -443,7 +443,7 @@ class ProductTemplate(models.Model): route_ids = fields.Many2many( 'stock.location.route', 'stock_route_product', 'product_id', 'route_id', 'Routes', domain=[('product_selectable', '=', True)], - help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, MTO, etc.") + help="Depending on the modules installed, this will allow you to define the route of the product: whether it will be bought, manufactured, replenished on order, etc.") nbr_reordering_rules = fields.Integer('Reordering Rules', compute='_compute_nbr_reordering_rules') # TDE FIXME: really used ? reordering_min_qty = fields.Float(compute='_compute_nbr_reordering_rules') diff --git a/odoo/addons/test_main_flows/static/src/js/tour.js b/odoo/addons/test_main_flows/static/src/js/tour.js index d79036346b2..4d29ed4e608 100644 --- a/odoo/addons/test_main_flows/static/src/js/tour.js +++ b/odoo/addons/test_main_flows/static/src/js/tour.js @@ -58,8 +58,8 @@ tour.register('main_flow_tour', { content: _t('Uncheck Buy'), position: 'right', }, { - trigger: '.o_field_widget[name=route_ids] .custom-checkbox > label:contains("Make To Order")', - content: _t('Uncheck Make To Order'), + trigger: '.o_field_widget[name=route_ids] .custom-checkbox > label:contains("Replenish on Order (MTO)")', + content: _t('Uncheck Replenish on Order (MTO)'), position: 'right', }, { trigger: '.o_notebook a:contains("General Information")', @@ -114,8 +114,8 @@ tour.register('main_flow_tour', { content: _t('Go to inventory tab'), position: 'top', }, { - trigger: '.o_field_widget[name=route_ids] .custom-checkbox > label:contains("Make To Order")', - content: _t('Check Make To Order'), + trigger: '.o_field_widget[name=route_ids] .custom-checkbox > label:contains("Replenish on Order (MTO)")', + content: _t('Check Replenish on Order (MTO)'), position: 'right', }, { trigger: '.o_notebook a:contains("Purchase")',