From a387e9591e5cfd77193eeaaa58d1cb8eaa950938 Mon Sep 17 00:00:00 2001 From: snd Date: Wed, 2 Aug 2023 13:15:09 +0200 Subject: [PATCH] [IMP] stock: rework properties button and kanban view The properties button has been moved to the contextual action menu. The kanban view now shows partner locations and internal location directly under a view location task 3444583 closes odoo/odoo#130509 Signed-off-by: Arnold Moyaux (arm) --- addons/stock/__manifest__.py | 1 + addons/stock/data/ir_actions_client_data.xml | 10 ++++++++++ addons/stock/models/stock_lot.py | 8 +++++++- addons/stock/views/stock_lot_views.xml | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 addons/stock/data/ir_actions_client_data.xml diff --git a/addons/stock/__manifest__.py b/addons/stock/__manifest__.py index e4570054120..0c443a9aab7 100644 --- a/addons/stock/__manifest__.py +++ b/addons/stock/__manifest__.py @@ -26,6 +26,7 @@ 'data/stock_data.xml', 'data/stock_sequence_data.xml', 'data/stock_traceability_report_data.xml', + 'data/ir_actions_client_data.xml', 'report/report_stock_quantity.xml', 'report/report_stock_reception.xml', diff --git a/addons/stock/data/ir_actions_client_data.xml b/addons/stock/data/ir_actions_client_data.xml new file mode 100644 index 00000000000..50bfc67e927 --- /dev/null +++ b/addons/stock/data/ir_actions_client_data.xml @@ -0,0 +1,10 @@ + + + + Add Properties + stock.lot + action_configure_properties_field + + form + + diff --git a/addons/stock/models/stock_lot.py b/addons/stock/models/stock_lot.py index 344a004604a..bffad005b81 100644 --- a/addons/stock/models/stock_lot.py +++ b/addons/stock/models/stock_lot.py @@ -16,6 +16,10 @@ class StockLot(models.Model): _check_company_auto = True _order = 'name, id' + def _read_group_location_id(self, locations, domain, order): + partner_locations = locations.search([('usage', 'in', ('customer', 'supplier'))]) + return partner_locations + locations.warehouse_id.search([]).lot_stock_id + name = fields.Char( 'Lot/Serial Number', default=lambda self: self.env['ir.sequence'].next_by_code('stock.lot.serial'), required=True, help="Unique Lot/Serial Number", index='trigram') @@ -35,7 +39,9 @@ class StockLot(models.Model): delivery_count = fields.Integer('Delivery order count', compute='_compute_delivery_ids') last_delivery_partner_id = fields.Many2one('res.partner', compute='_compute_delivery_ids') lot_properties = fields.Properties('Properties', definition='product_id.lot_properties_definition', copy=True) - location_id = fields.Many2one('stock.location', 'Location', compute='_compute_single_location', store=True, readonly=False, inverse='_set_single_location', domain="[('usage', '!=', 'view')]") + location_id = fields.Many2one( + 'stock.location', 'Location', compute='_compute_single_location', store=True, readonly=False, + inverse='_set_single_location', domain="[('usage', '!=', 'view')]", group_expand='_read_group_location_id') @api.model def generate_lot_names(self, first_lot, count): diff --git a/addons/stock/views/stock_lot_views.xml b/addons/stock/views/stock_lot_views.xml index 6389d97c618..65e1358bd59 100644 --- a/addons/stock/views/stock_lot_views.xml +++ b/addons/stock/views/stock_lot_views.xml @@ -47,7 +47,7 @@ - +