Skip to content

Commit e3c0e04

Browse files
lanto-razafindrabemajouda
authored andcommitted
TA#48326 [ADD][IMP] Change module name and moving module to stock addons
1 parent 372c9ab commit e3c0e04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+345
-625
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Product Packaging Dimension Decimal and Changeable UOM
2+
======================================================
3+
Add changeable UOM and allow decimal on product packaging.
4+
5+
Usage
6+
-----
7+
As an Administrator of Inventory and having the access right for ``Manage Packages``,
8+
I go to ``Inventory > Configuration > Delivery Packages``.
9+
10+
.. image:: ./static/description/package_type_A.png
11+
12+
In the form view, I can see that ``Height``, ``Width`` and ``Length`` can be in decimal value.
13+
I also can change the unit of measure of each property to ``m`` or ``ft``.
14+
15+
.. image:: ./static/description/decimal_value_and_uom.png
16+
17+
Contributors
18+
------------
19+
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)
20+
21+
More information
22+
----------------
23+
* Meet us at https://bit.ly/numigi-com
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# © 2023 - Today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).
3+
4+
{
5+
'name': 'Product Packaging Dimension Decimal and Changeable UOM',
6+
'version': "1.0.0",
7+
'author': 'Numigi',
8+
'maintainer': 'Numigi',
9+
'website': 'https://bit.ly/numigi-com',
10+
'license': 'AGPL-3',
11+
'category': 'Stock',
12+
'summary': 'Add changeable UOM and allow decimal on product packaging.',
13+
'depends': [
14+
'delivery',
15+
],
16+
'data': [
17+
'views/product_packaging.xml',
18+
],
19+
'installable': True,
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * product_packaging_dimension_decimal
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2023-02-27 13:21+0000\n"
10+
"PO-Revision-Date: 2023-02-27 13:21+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: product_packaging_dimension_decimal
19+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__display_name
20+
msgid "Display Name"
21+
msgstr "Nom affiché"
22+
23+
#. module: product_packaging_dimension_decimal
24+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__height
25+
msgid "Height"
26+
msgstr "Hauteur"
27+
28+
#. module: product_packaging_dimension_decimal
29+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__height_uom_id
30+
msgid "Height UOM"
31+
msgstr "Unité de mesure du hauteur"
32+
33+
#. module: product_packaging_dimension_decimal
34+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__id
35+
msgid "ID"
36+
msgstr ""
37+
38+
#. module: product_packaging_dimension_decimal
39+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging____last_update
40+
msgid "Last Modified on"
41+
msgstr "Dernière modification le"
42+
43+
#. module: product_packaging_dimension_decimal
44+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__length_uom_id
45+
msgid "Length UOM"
46+
msgstr "Unité de mesure du longueur"
47+
48+
#. module: product_packaging_dimension_decimal
49+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__packaging_length
50+
msgid "Length"
51+
msgstr "Longueur"
52+
53+
#. module: product_packaging_dimension_decimal
54+
#: model:ir.model,name:product_packaging_dimension_decimal.model_product_packaging
55+
msgid "Product Packaging"
56+
msgstr "Emballage des produits"
57+
58+
#. module: product_packaging_dimension_decimal
59+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__width
60+
msgid "Width"
61+
msgstr "Largeur"
62+
63+
#. module: product_packaging_dimension_decimal
64+
#: model:ir.model.fields,field_description:product_packaging_dimension_decimal.field_product_packaging__width_uom_id
65+
msgid "Width UOM"
66+
msgstr "Unité de mesure du largeur"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
4+
from . import product_packaging
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
4+
5+
from odoo import fields, models
6+
7+
8+
class ProductPackaging(models.Model):
9+
"""Change integer field to float."""
10+
11+
_inherit = "product.packaging"
12+
13+
def _get_uom_domain(self):
14+
uom_ids = []
15+
uom_ids.extend(
16+
(
17+
self.env.ref("uom.product_uom_foot").id,
18+
self.env.ref("uom.product_uom_meter").id,
19+
)
20+
)
21+
return [("id", "in", uom_ids)]
22+
23+
def _get_default_uom(self):
24+
return self.env.ref("uom.product_uom_meter")
25+
26+
height = fields.Float("Height")
27+
width = fields.Float("Width")
28+
packaging_length = fields.Float("Length")
29+
height_uom_id = fields.Many2one(
30+
"uom.uom",
31+
string="Height UOM",
32+
domain=_get_uom_domain,
33+
default=_get_default_uom
34+
)
35+
width_uom_id = fields.Many2one(
36+
"uom.uom",
37+
string="Width UOM",
38+
domain=_get_uom_domain,
39+
default=_get_default_uom
40+
)
41+
length_uom_id = fields.Many2one(
42+
"uom.uom",
43+
string="Length UOM",
44+
domain=_get_uom_domain,
45+
default=_get_default_uom
46+
)
47+
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
4+
from . import (
5+
test_product_packaging_uom,
6+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
4+
from odoo.tests import common
5+
6+
7+
class TestProductPackagingUom(common.SavepointCase):
8+
9+
@classmethod
10+
def setUpClass(cls):
11+
super().setUpClass()
12+
cls.foot = cls.env.ref('uom.product_uom_foot')
13+
cls.meter = cls.env.ref('uom.product_uom_meter')
14+
cls.height = 1.35
15+
cls.packaging_length = 1.50
16+
cls.width = 2.88
17+
18+
def test_foot_height_value_on_measure_is_float(self):
19+
self.product_package = self.env['product.packaging'].create({
20+
'name': 'Test product packaging',
21+
'height': self.height,
22+
'packaging_length': self.packaging_length,
23+
'width': self.width,
24+
})
25+
26+
self.product_package.refresh()
27+
28+
self.assertEqual(self.product_package.height, self.height)
29+
self.assertEqual(self.product_package.packaging_length, self.packaging_length)
30+
self.assertEqual(self.product_package.width, self.width)
31+
32+
def test_product_packaging_uom(self):
33+
self.product_package_1_ft = self.env['product.packaging'].create({
34+
'name': 'Test product packaging - foot',
35+
'height': self.height,
36+
'height_uom_id': self.foot.id,
37+
'packaging_length': self.packaging_length,
38+
'length_uom_id': self.foot.id,
39+
'width': self.width,
40+
'width_uom_id': self.foot.id,
41+
})
42+
43+
self.product_package_2_m = self.env['product.packaging'].create({
44+
'name': 'Test product packaging - meter',
45+
'height': self.height,
46+
'height_uom_id': self.meter.id,
47+
'packaging_length': self.packaging_length,
48+
'length_uom_id': self.meter.id,
49+
'width': self.width,
50+
'width_uom_id': self.meter.id,
51+
})
52+
53+
self.product_package_1_ft.refresh()
54+
self.product_package_2_m.refresh()
55+
56+
self.assertEqual(self.product_package_1_ft.height_uom_id, self.foot)
57+
self.assertEqual(self.product_package_1_ft.length_uom_id, self.foot)
58+
self.assertEqual(self.product_package_1_ft.width_uom_id, self.foot)
59+
self.assertEqual(self.product_package_2_m.height_uom_id, self.meter)
60+
self.assertEqual(self.product_package_2_m.length_uom_id, self.meter)
61+
self.assertEqual(self.product_package_2_m.width_uom_id, self.meter)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<odoo>
3+
4+
<!-- Allow user to record float value -->
5+
<record id="product_packaging_measure_float_value" model="ir.ui.view">
6+
<field name="name">Product Packaging: changing to float field</field>
7+
<field name="model">product.packaging</field>
8+
<field name="inherit_id" ref="delivery.product_packaging_delivery_form"/>
9+
<field name="arch" type="xml">
10+
11+
<!-- Hide the default uom char field instead of replacing it ...-->
12+
<xpath expr="//div[@name='height']/span/field[@name='length_uom_name']" position="attributes">
13+
<attribute name="invisible">1</attribute>
14+
</xpath>
15+
<xpath expr="//div[@name='width']/span/field[@name='length_uom_name']" position="attributes">
16+
<attribute name="invisible">1</attribute>
17+
</xpath>
18+
<xpath expr="//div[@name='packaging_length']/span/field[@name='length_uom_name']" position="attributes">
19+
<attribute name="invisible">1</attribute>
20+
</xpath>
21+
22+
<!-- ... then add the many2one uom field -->
23+
<xpath expr="//div[@name='height']/span/field[@name='length_uom_name']" position="before">
24+
<field name="height_uom_id" nolabel="1" style="width:90px"/>
25+
</xpath>
26+
<xpath expr="//div[@name='width']/span/field[@name='length_uom_name']" position="before">
27+
<field name="width_uom_id" nolabel="1" style="width:90px"/>
28+
</xpath>
29+
<xpath expr="//div[@name='packaging_length']/span/field[@name='length_uom_name']" position="before">
30+
<field name="length_uom_id" nolabel="1" style="width:90px"/>
31+
</xpath>
32+
33+
</field>
34+
</record>
35+
36+
</odoo>

stock_quant_package_product_packaging_dimension/__manifest__.py stock_product_packaging_dimension/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
'name': 'Product Quant Package Dimension',
6-
'version': "14.0.1",
6+
'version': "1.0.0",
77
'author': 'Numigi',
88
'maintainer': 'Numigi',
99
'website': 'https://bit.ly/numigi-com',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * stock_product_packaging_dimension
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 14.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2023-02-27 13:15+0000\n"
10+
"PO-Revision-Date: 2023-02-27 13:15+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: stock_product_packaging_dimension
19+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__display_name
20+
msgid "Display Name"
21+
msgstr "Nom affiché"
22+
23+
#. module: stock_product_packaging_dimension
24+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__height
25+
msgid "Height"
26+
msgstr "Hauteur"
27+
28+
#. module: stock_product_packaging_dimension
29+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__height_uom_id
30+
msgid "Height UOM"
31+
msgstr "Unité de mesure du hauteur"
32+
33+
#. module: stock_product_packaging_dimension
34+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__id
35+
msgid "ID"
36+
msgstr ""
37+
38+
#. module: stock_product_packaging_dimension
39+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package____last_update
40+
msgid "Last Modified on"
41+
msgstr "Dernière modification le"
42+
43+
#. module: stock_product_packaging_dimension
44+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__length_uom_id
45+
msgid "Length UOM"
46+
msgstr "Unité de mesure du longueur"
47+
48+
#. module: stock_product_packaging_dimension
49+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__packaging_length
50+
msgid "Length"
51+
msgstr "Longueur"
52+
53+
#. module: stock_product_packaging_dimension
54+
#: model:ir.model,name:stock_product_packaging_dimension.model_stock_quant_package
55+
msgid "Packages"
56+
msgstr "Colis"
57+
58+
#. module: stock_product_packaging_dimension
59+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__width
60+
msgid "Width"
61+
msgstr "Largeur"
62+
63+
#. module: stock_product_packaging_dimension
64+
#: model:ir.model.fields,field_description:stock_product_packaging_dimension.field_stock_quant_package__width_uom_id
65+
msgid "Width UOM"
66+
msgstr "Unité de mesure du largeur"
Loading
Loading

stock_quant_package_product_packaging_dimension/views/stock_quant_package.xml stock_product_packaging_dimension/views/stock_quant_package.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
<label for="height"/>
1313
<div class="o_row" name="Height">
1414
<field name='height'/>
15-
<span><field name="height_uom_id" nolabel="1" style="width:25%%"/></span>
15+
<span><field name="height_uom_id" nolabel="1" style="width:90px"/></span>
1616
</div>
1717
<label for="width"/>
1818
<div class="o_row" name="Width">
1919
<field name='width'/>
20-
<span><field name="width_uom_id" nolabel="1" style="width:25%%"/></span>
20+
<span><field name="width_uom_id" nolabel="1" style="width:90px"/></span>
2121
</div>
2222
<label for="packaging_length"/>
2323
<div class="o_row" name="Length">
2424
<field name='packaging_length'/>
25-
<span><field name="length_uom_id" nolabel="1" style="width:25%%"/></span>
25+
<span><field name="length_uom_id" nolabel="1" style="width:90px"/></span>
2626
</div>
2727
</group>
2828
</xpath>

stock_quant_package_product_packaging_uom/README.rst stock_product_packaging_uom/README.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ Usage
66
-----
77
As an User of Inventory, I go to ``Inventory > Products > Packages``.
88

9-
.. image:: ./static/description/stock_quant_package_menu.png
10-
119
In the form view, the following fields value will be changed when selecting a package type:
1210
``Height``, ``Width`` and ``Length``.
1311
Values are set from the value of the package type.
14-
Then, I also can change the unit of measure of each property to ``m`` or ``ft``.
12+
Then, I also can change the unit of measure of each property to ``m`` or ``ft``.
13+
14+
.. image:: ./static/description/stock_quant_package_dimension_changes.png
15+
16+
If we check the dimensions of the package type, it matches on the changes.
1517

16-
.. image:: ./static/description/stock_quant_package_dimension.png
18+
.. image:: ./static/description/packaging_type_dimension.png
1719

1820
Contributors
1921
------------
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# © 2023 Numigi (tm) and all its contributors (https://bit.ly/numigiens)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
3+
4+
from . import models

0 commit comments

Comments
 (0)