From 4fee888be4dc700233e3fda89548826729bcd1e0 Mon Sep 17 00:00:00 2001 From: Akim Juillerat Date: Thu, 28 Nov 2019 17:45:15 +0100 Subject: [PATCH] Integrate stock_cubiscan with product packaging types --- stock_cubiscan/__manifest__.py | 2 +- stock_cubiscan/models/stock.py | 28 ++----------------- .../views/product_packaging_views.xml | 24 ---------------- 3 files changed, 3 insertions(+), 51 deletions(-) delete mode 100644 stock_cubiscan/views/product_packaging_views.xml diff --git a/stock_cubiscan/__manifest__.py b/stock_cubiscan/__manifest__.py index 541134aa3..5e6c6ff3c 100644 --- a/stock_cubiscan/__manifest__.py +++ b/stock_cubiscan/__manifest__.py @@ -11,13 +11,13 @@ 'barcodes', 'stock', 'web_tree_dynamic_colored_field', + 'product_packaging_dimension', 'product_packaging_type_required', ], 'website': 'http://www.camptocamp.com', 'data': [ 'views/assets.xml', 'views/cubiscan_view.xml', - 'views/product_packaging_views.xml', 'wizard/cubiscan_wizard.xml', 'security/ir.model.access.csv', ], diff --git a/stock_cubiscan/models/stock.py b/stock_cubiscan/models/stock.py index c2dd191b6..973ad6c54 100644 --- a/stock_cubiscan/models/stock.py +++ b/stock_cubiscan/models/stock.py @@ -1,7 +1,7 @@ # Copyright 2019 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import api, fields, models +from odoo import fields, models class StockWarehouse(models.Model): @@ -14,6 +14,7 @@ class StockWarehouse(models.Model): class ProductPackaging(models.Model): _inherit = "product.packaging" + # FIXME: Not sure this is still the best place for this constraint _sql_constraints = [ ( 'product_packaging_type_unique', @@ -22,28 +23,3 @@ class ProductPackaging(models.Model): 'with the same type for a given product.', ) ] - - # TODO move these in an addon. Warning: - # * 'delivery' defines the same fields and add them in the 'Delivery - # Packages' view - # * our put-away modules (wms/stock_putaway_storage_type_strategy) will - # need these fields as well - max_weight = fields.Float() - length = fields.Integer('Length (mm)', help='length in millimeters') - width = fields.Integer('Width (mm)', help='width in millimeters') - height = fields.Integer('Height (mm)', help='height in millimeters') - volume = fields.Float( - 'Volume (m³)', - digits=(8, 4), - compute='_compute_volume', - readonly=True, - store=False, - help='volume in cubic meters', - ) - - @api.depends('length', 'width', 'height') - def _compute_volume(self): - for pack in self: - pack.volume = ( - pack.length * pack.width * pack.height - ) / 1000.0 ** 3 diff --git a/stock_cubiscan/views/product_packaging_views.xml b/stock_cubiscan/views/product_packaging_views.xml deleted file mode 100644 index 676762eb8..000000000 --- a/stock_cubiscan/views/product_packaging_views.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - product.packaging.form.view - product.packaging - - - - - - - - - - - - - - -