From 4dd3104b96682df623e1320aff1889ce8cf01dfa Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Fri, 16 Dec 2022 16:27:06 +0000 Subject: [PATCH] [IMP] product_expiry,purchase_requisition,stock*: visual changes - The `picking_type_id` field in the pickings form view is not openable; - Display the `description` field (optional) in the SVL list view; - Add the `expiration_date` field (optional) in the quant list views; - Add a description text for the landed cost; - Renames field `requisition_id`: "Purchase Agreement" > "Blanket Order" - In Inventory Adjustment, hides the "Apply All" button is at least one record is selected; - In `product_expiry`, renames two views to stick to the XML's coding guidelines: https://www.odoo.com/documentation/16.0/contributing/development/coding_guidelines.html#xml-ids-and-naming - For the replenishment: - Places the field `product_id` as the first option when the user writes something in the searchbar; - Renames `route_id`: "Preferred Route" > "Route"; - Renames the button "Automate Orders" into "Automate"; - Set the `route_id` field as "optional=hide" until `mrp_purchase` is installed (in this case, it will be set as "optional=show") because in this case, there is at least two routes (Buy and Manufacturing). task-3076044 Part-of: odoo/odoo#109511 --- addons/product_expiry/models/stock_quant.py | 5 ++-- .../views/stock_quant_views.xml | 26 +++++++++++++++---- addons/purchase_mrp/__manifest__.py | 1 + .../views/stock_orderpoint_views.xml | 13 ++++++++++ .../purchase_requisition/models/purchase.py | 2 +- addons/purchase_stock/views/stock_views.xml | 2 +- addons/stock/models/stock_orderpoint.py | 2 +- .../src/views/list/inventory_report_list.xml | 2 +- addons/stock/views/stock_orderpoint_views.xml | 8 +++--- addons/stock/views/stock_picking_views.xml | 2 +- .../views/stock_valuation_layer_views.xml | 1 + .../views/stock_landed_cost_views.xml | 2 ++ 12 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 addons/purchase_mrp/views/stock_orderpoint_views.xml diff --git a/addons/product_expiry/models/stock_quant.py b/addons/product_expiry/models/stock_quant.py index 34e31b546ae..82841407efd 100644 --- a/addons/product_expiry/models/stock_quant.py +++ b/addons/product_expiry/models/stock_quant.py @@ -7,6 +7,7 @@ from odoo import api, fields, models class StockQuant(models.Model): _inherit = 'stock.quant' + expiration_date = fields.Datetime(related='lot_id.expiration_date', store=True, readonly=False) removal_date = fields.Datetime(related='lot_id.removal_date', store=True, readonly=False) use_expiration_date = fields.Boolean(related='product_id.use_expiration_date', readonly=True) @@ -15,7 +16,7 @@ class StockQuant(models.Model): """ Returns a list of fields user can edit when he want to create a quant in `inventory_mode`. """ res = super()._get_inventory_fields_create() - res += ['removal_date'] + res += ['expiration_date', 'removal_date'] return res @api.model @@ -23,7 +24,7 @@ class StockQuant(models.Model): """ Returns a list of fields user can edit when he want to edit a quant in `inventory_mode`. """ res = super()._get_inventory_fields_write() - res += ['removal_date'] + res += ['expiration_date', 'removal_date'] return res @api.model diff --git a/addons/product_expiry/views/stock_quant_views.xml b/addons/product_expiry/views/stock_quant_views.xml index e16c047af1d..8d2a4744c98 100644 --- a/addons/product_expiry/views/stock_quant_views.xml +++ b/addons/product_expiry/views/stock_quant_views.xml @@ -1,7 +1,7 @@ - - stock.quant.inherit.form + + stock.quant.tree.inherit.expiry_date stock.quant @@ -16,19 +16,35 @@ - - stock.quant.inherit.form + + stock.quant.tree.editable.inherit.expiry_date stock.quant + + + stock.quant.inventory.tree.editable.inherit.expiry_date + stock.quant + + + + + + + + + stock.quant.search.inherit stock.quant @@ -40,5 +56,5 @@ domain="[('lot_id.alert_date', '<=', context_today().strftime('%Y-%m-%d'))]"/> - + diff --git a/addons/purchase_mrp/__manifest__.py b/addons/purchase_mrp/__manifest__.py index 381224ba3bb..0ecd04d64ec 100644 --- a/addons/purchase_mrp/__manifest__.py +++ b/addons/purchase_mrp/__manifest__.py @@ -17,6 +17,7 @@ from purchase order. 'views/mrp_bom_views.xml', 'views/purchase_order_views.xml', 'views/mrp_production_views.xml', + 'views/stock_orderpoint_views.xml', 'security/ir.model.access.csv', ], 'depends': ['mrp', 'purchase_stock'], diff --git a/addons/purchase_mrp/views/stock_orderpoint_views.xml b/addons/purchase_mrp/views/stock_orderpoint_views.xml new file mode 100644 index 00000000000..0ebf78b4d7e --- /dev/null +++ b/addons/purchase_mrp/views/stock_orderpoint_views.xml @@ -0,0 +1,13 @@ + + + + stock.warehouse.orderpoint.tree.editable.inherit.show_route + stock.warehouse.orderpoint + + + + show + + + + diff --git a/addons/purchase_requisition/models/purchase.py b/addons/purchase_requisition/models/purchase.py index f771d99c8d1..19f3fadec05 100644 --- a/addons/purchase_requisition/models/purchase.py +++ b/addons/purchase_requisition/models/purchase.py @@ -23,7 +23,7 @@ class PurchaseOrderGroup(models.Model): class PurchaseOrder(models.Model): _inherit = 'purchase.order' - requisition_id = fields.Many2one('purchase.requisition', string='Purchase Agreement', copy=False) + requisition_id = fields.Many2one('purchase.requisition', string='Blanket Order', copy=False) is_quantity_copy = fields.Selection(related='requisition_id.is_quantity_copy', readonly=False) purchase_group_id = fields.Many2one('purchase.order.group') diff --git a/addons/purchase_stock/views/stock_views.xml b/addons/purchase_stock/views/stock_views.xml index 0e439d24556..7d9294b69d5 100644 --- a/addons/purchase_stock/views/stock_views.xml +++ b/addons/purchase_stock/views/stock_views.xml @@ -32,7 +32,7 @@ - + diff --git a/addons/stock/models/stock_orderpoint.py b/addons/stock/models/stock_orderpoint.py index 5b0f6600d06..8b7dc37b849 100644 --- a/addons/stock/models/stock_orderpoint.py +++ b/addons/stock/models/stock_orderpoint.py @@ -83,7 +83,7 @@ class StockWarehouseOrderpoint(models.Model): rule_ids = fields.Many2many('stock.rule', string='Rules used', compute='_compute_rules') lead_days_date = fields.Date(compute='_compute_lead_days') route_id = fields.Many2one( - 'stock.route', string='Preferred Route', domain="[('product_selectable', '=', True)]") + 'stock.route', string='Route', domain="[('product_selectable', '=', True)]") qty_on_hand = fields.Float('On Hand', readonly=True, compute='_compute_qty', digits='Product Unit of Measure') qty_forecast = fields.Float('Forecast', readonly=True, compute='_compute_qty', digits='Product Unit of Measure') qty_to_order = fields.Float('To Order', compute='_compute_qty_to_order', store=True, readonly=False, digits='Product Unit of Measure') diff --git a/addons/stock/static/src/views/list/inventory_report_list.xml b/addons/stock/static/src/views/list/inventory_report_list.xml index 808c7353351..81eb95d6f97 100644 --- a/addons/stock/static/src/views/list/inventory_report_list.xml +++ b/addons/stock/static/src/views/list/inventory_report_list.xml @@ -3,7 +3,7 @@ - diff --git a/addons/stock/views/stock_orderpoint_views.xml b/addons/stock/views/stock_orderpoint_views.xml index 1477f1cff8e..8a5bb794963 100644 --- a/addons/stock/views/stock_orderpoint_views.xml +++ b/addons/stock/views/stock_orderpoint_views.xml @@ -50,7 +50,7 @@