mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
Integrate stock_cubiscan with product packaging types
This commit is contained in:
committed by
Guewen Baconnier
parent
575e06fade
commit
4fee888be4
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- TODO the fields have to be moved to a standalone module
|
||||
See the comment in models/stock.py
|
||||
-->
|
||||
<record id="product_packaging_form_view" model="ir.ui.view">
|
||||
<field name="name">product.packaging.form.view</field>
|
||||
<field name="model">product.packaging</field>
|
||||
<field name="inherit_id" ref="product.product_packaging_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="qty" position="after">
|
||||
<group name="size">
|
||||
<field name="height"/>
|
||||
<field name="width"/>
|
||||
<field name="length"/>
|
||||
<field name="volume"/>
|
||||
<field name="max_weight"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user