Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
2,515 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
{ | ||
"name": "Product Dangerous Good", | ||
"summary": "Allows to set appropriate danger class and components to products", | ||
"version": "12.0.1.0.0", | ||
"development_status": "Alpha", | ||
"category": "Product", | ||
"website": "https://github.com/OCA/stock-logistics-reporting", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"product", | ||
], | ||
"data": [ | ||
"data/product_dangerous_type_data.xml", | ||
"data/product_dangerous_class_data.xml", | ||
"views/product_template_view.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
} |
101 changes: 101 additions & 0 deletions
101
product_dangerous_good/data/product_dangerous_class_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="dangerous_class_1" model="product.dangerous.class"> | ||
<field name="name">Explosives </field> | ||
<field name="code">ADR_1</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_1.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_1"/> | ||
</record> | ||
<record id="dangerous_class_2" model="product.dangerous.class"> | ||
<field name="name">Flammable gases </field> | ||
<field name="code">ADR_2.1</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_2.1.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_2_1"/> | ||
</record> | ||
<record id="dangerous_class_3" model="product.dangerous.class"> | ||
<field name="name">Non-toxic and non-flammable gases</field> | ||
<field name="code">ADR_2.2</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_2.2.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_2_1"/> | ||
</record> | ||
<record id="dangerous_class_4" model="product.dangerous.class"> | ||
<field name="name">Poison gases </field> | ||
<field name="code">ADR_2.3</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_2.3.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_2_3"/> | ||
</record> | ||
<record id="dangerous_class_5" model="product.dangerous.class"> | ||
<field name="name">Flammable liquids</field> | ||
<field name="code">ADR_3</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_3.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_3"/> | ||
</record> | ||
<record id="dangerous_class_6" model="product.dangerous.class"> | ||
<field name="name">Flammable solids </field> | ||
<field name="code">ADR_4.1</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_4.1.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_4_1"/> | ||
</record> | ||
<record id="dangerous_class_7" model="product.dangerous.class"> | ||
<field name="name">Spontaneously combustibles</field> | ||
<field name="code">ADR_4.2</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_4.2.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_4_2"/> | ||
</record> | ||
<record id="dangerous_class_8" model="product.dangerous.class"> | ||
<field name="name"> Dangerous when wet</field> | ||
<field name="code">ADR_4</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_4.3.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_4_3"/> | ||
</record> | ||
<record id="dangerous_class_9" model="product.dangerous.class"> | ||
<field name="name">Oxidizers</field> | ||
<field name="code">ADR_5_1</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_5.1.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_5_1"/> | ||
</record> | ||
<record id="dangerous_class_10" model="product.dangerous.class"> | ||
<field name="name">Organic peroxides</field> | ||
<field name="code">ADR_5_2</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_5.2.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_5_2"/> | ||
</record> | ||
<record id="dangerous_class_11" model="product.dangerous.class"> | ||
<field name="name">Poison</field> | ||
<field name="code">ADR_6</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/Dangclass6_1.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_6_1"/> | ||
</record> | ||
<record id="dangerous_class_12" model="product.dangerous.class"> | ||
<field name="name">Infectious substances </field> | ||
<field name="code">ADR_6.2</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_6.2.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_6_2"/> | ||
</record> | ||
<record id="dangerous_class_13" model="product.dangerous.class"> | ||
<field name="name">Radioactive</field> | ||
<field name="code">ADR_7B</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_7B.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_7"/> | ||
</record> | ||
<record id="dangerous_class_14" model="product.dangerous.class"> | ||
<field name="name">Corrosive</field> | ||
<field name="code">ADR_8</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/UN_transport_pictogram_-_8.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_8"/> | ||
</record> | ||
<record id="dangerous_class_15" model="product.dangerous.class"> | ||
<field name="name">9 Miscellaneous dangerous substances</field> | ||
<field name="code">ADR_9</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_9.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_9"/> | ||
</record> | ||
<record id="dangerous_class_16" model="product.dangerous.class"> | ||
<field name="name">9A Lithium Ion Batteries </field> | ||
<field name="code">ADR_9A</field> | ||
<field name="image" type="base64" file="product_dangerous_good/static/img/ADR_9A.svg"/> | ||
<field name="class_type" ref="dangerous_type_class_9"/> | ||
</record> | ||
|
||
</odoo> |
69 changes: 69 additions & 0 deletions
69
product_dangerous_good/data/product_dangerous_type_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
|
||
<record id="dangerous_type_class_1" model="product.dangerous.class.type"> | ||
<field name="name">Explosives</field> | ||
<field name="division">1</field> | ||
</record> | ||
<record id="dangerous_type_class_2" model="product.dangerous.class.type"> | ||
<field name="name">Gases, including compressed, liquified, and dissolved under pressure gases and vapors </field> | ||
<field name="division">2</field> | ||
</record> | ||
<record id="dangerous_type_class_2_1" model="product.dangerous.class.type"> | ||
<field name="name">Flammable gases</field> | ||
<field name="division">2.1</field> | ||
</record> | ||
<record id="dangerous_type_class_2_2" model="product.dangerous.class.type"> | ||
<field name="name">Non-toxic and non-flammable gases</field> | ||
<field name="division">2.2</field> | ||
</record> | ||
<record id="dangerous_type_class_2_3" model="product.dangerous.class.type"> | ||
<field name="name">Toxic</field> | ||
<field name="division">2.3</field> | ||
</record> | ||
<record id="dangerous_type_class_3" model="product.dangerous.class.type"> | ||
<field name="name">Flammable liquids</field> | ||
<field name="division">3</field> | ||
</record> | ||
<record id="dangerous_type_class_4_1" model="product.dangerous.class.type"> | ||
<field name="name">Flammable solids, self-reactive substances, and solid desensitized explosives</field> | ||
<field name="division">4.1</field> | ||
</record> | ||
<record id="dangerous_type_class_4_2" model="product.dangerous.class.type"> | ||
<field name="name">Substances liable to spontaneous combustion</field> | ||
<field name="division">4.2</field> | ||
</record> | ||
<record id="dangerous_type_class_4_3" model="product.dangerous.class.type"> | ||
<field name="name">Substances which, in contact with water, emit flammable gases</field> | ||
<field name="division">4.3</field> | ||
</record> | ||
<record id="dangerous_type_class_5_1" model="product.dangerous.class.type"> | ||
<field name="name">Oxidizing substances</field> | ||
<field name="division">5.1</field> | ||
</record> | ||
<record id="dangerous_type_class_5_2" model="product.dangerous.class.type"> | ||
<field name="name">Organic peroxides</field> | ||
<field name="division">5.2</field> | ||
</record> | ||
<record id="dangerous_type_class_6_1" model="product.dangerous.class.type"> | ||
<field name="name">Toxic substances</field> | ||
<field name="division">6.1</field> | ||
</record> | ||
<record id="dangerous_type_class_6_2" model="product.dangerous.class.type"> | ||
<field name="name">Infectious substances</field> | ||
<field name="division">6.2</field> | ||
</record> | ||
<record id="dangerous_type_class_7" model="product.dangerous.class.type"> | ||
<field name="name">Radioactive material</field> | ||
<field name="division">7</field> | ||
</record> | ||
<record id="dangerous_type_class_8" model="product.dangerous.class.type"> | ||
<field name="name">Corrosive substances</field> | ||
<field name="division">8</field> | ||
</record> | ||
<record id="dangerous_type_class_9" model="product.dangerous.class.type"> | ||
<field name="name">Miscellaneous dangerous substances and articles</field> | ||
<field name="division">9</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import product_dangerous | ||
from . import product_template | ||
from . import product_dangerous_component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
from odoo import api, models, fields | ||
|
||
|
||
class ProductDangerousClass(models.Model): | ||
_name = "product.dangerous.class" | ||
_description = "Product Dangerous Class" | ||
|
||
name = fields.Char(required=True) | ||
code = fields.Char(required=True) | ||
image = fields.Binary(string='Icon', required=True) | ||
class_type = fields.Many2one( | ||
comodel_name="product.dangerous.class.type", | ||
ondelete="restrict", | ||
string="Dangerous Type", | ||
) | ||
|
||
_sql_constraints = [ | ||
('code_unique', 'unique(code)', 'This code already exist') | ||
] | ||
|
||
|
||
class ProductDangerousClassType(models.Model): | ||
_name = "product.dangerous.class.type" | ||
_description = "Product Dangerous Type" | ||
|
||
name = fields.Char(required=True) | ||
division = fields.Char() |
18 changes: 18 additions & 0 deletions
18
product_dangerous_good/models/product_dangerous_component.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
from odoo import api, models, fields | ||
|
||
|
||
class ProductDangerousComponent(models.Model): | ||
_name = "product.dangerous.component" | ||
_description = "Product Dangerous Component" | ||
|
||
dangerous_product = fields.Many2one(comodel_name='product.dangerous.class', string='Dangerous product') | ||
weight = fields.Float(help="The weight of dangerous product in main product.") | ||
volume = fields.Float(help="The volume of dangerous product in main product.") | ||
dangerous_class = fields.Many2one( | ||
comodel_name="product.dangerous.class", | ||
ondelete="restrict", | ||
string="Dangerous Class", | ||
) | ||
product_template_id = fields.One2many('product.template', 'dangerous_component_ids', string='Product') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2019 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
from odoo import api, models, fields | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
dangerous_class = fields.Many2one( | ||
comodel_name="product.dangerous.class", | ||
ondelete="restrict", | ||
string="Dangerous Class", | ||
) | ||
is_dangerous_good = fields.Boolean( | ||
help="This product belongs to dangerous class" | ||
) | ||
is_dangerous_waste = fields.Boolean( | ||
help="Waste of this product belongs to dangerous class" | ||
) | ||
dangerous_component_ids = fields.One2many('product.dangerous.component', 'product_template_id', string='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This addon adds possibility to mark products with dangerous class due to European Agreement concerning the International Carriage of Dangerous Goods by Road (ADR) | ||
If you product contains dangerous product or waste you can add this to product composition | ||
and set weight and volume of this composition. | ||
|
||
Read more | ||
https://en.wikipedia.org/wiki/ADR_(treaty) | ||
Unece standards https://www.unece.org/trans/danger/publi/adr/adr2011/11ContentsE.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_product_dangerous_class_user,product.dangerous.class user,model_product_dangerous_class,,1,0,0,0 | ||
access_product_dangerous_class_manager,product.dangerous.class manager,model_product_dangerous_class,base.group_erp_manager,1,1,1,1 | ||
access_product_dangerous_class_type_user,product.dangerous.class.type user,model_product_dangerous_class_type,,1,0,0,0 | ||
access_product_dangerous_class_type_manager,product.dangerous.class.type manager,model_product_dangerous_class_type,base.group_erp_manager,1,1,1,1 | ||
access_product_dangerous_component,product.dangerous.component,model_product_dangerous_component,,1,1,1,1 |
Oops, something went wrong.