diff --git a/product_print_category_supermarket/__init__.py b/product_print_category_supermarket/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/product_print_category_supermarket/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_print_category_supermarket/__manifest__.py b/product_print_category_supermarket/__manifest__.py new file mode 100644 index 0000000..f9e4b57 --- /dev/null +++ b/product_print_category_supermarket/__manifest__.py @@ -0,0 +1,30 @@ +# Copyright 2022 Criptomart +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Product Labels for supermarkets", + "description": """ + Extends product_print_category adding labels for Supermarkets""", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Criptomart", + "website": "https://criptomart.net", + "depends": [ + "product_print_category", + "product_origin", + "product_template_tags", + ], + "data": [ + "views/report_pricetag_normal.xml", + "views/product_template_tag.xml", + "views/product_template.xml", + "views/res_config.xml", + "data/product_print_category.xml", + ], + "assets": { + "web.report_assets_common": [ + "/product_print_category_supermarket/static/css/pricetag_60x30mm.scss", + ] + }, + "demo": [], +} diff --git a/product_print_category_supermarket/data/product_print_category.xml b/product_print_category_supermarket/data/product_print_category.xml new file mode 100644 index 0000000..f837962 --- /dev/null +++ b/product_print_category_supermarket/data/product_print_category.xml @@ -0,0 +1,18 @@ + + + + + Normal pricetag - 60x30mm + + + + + diff --git a/product_print_category_supermarket/models/__init__.py b/product_print_category_supermarket/models/__init__.py new file mode 100644 index 0000000..4ac41a2 --- /dev/null +++ b/product_print_category_supermarket/models/__init__.py @@ -0,0 +1,3 @@ +from . import product_template +from . import product_template_tag +from . import res_config diff --git a/product_print_category_supermarket/models/product_template.py b/product_print_category_supermarket/models/product_template.py new file mode 100644 index 0000000..fe667f1 --- /dev/null +++ b/product_print_category_supermarket/models/product_template.py @@ -0,0 +1,27 @@ +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + origin = fields.Char() + code_balance = fields.Integer("Balance Code") + ingredients = fields.Text() + expiration_date = fields.Date("Expiration Date") + + @api.model + def get_price_member(self): + param_value = ( + self.env["ir.config_parameter"] + .sudo() + .get_param("report_label_supermarket.label_pricelist") + ) + pricelist = self.env["product.pricelist"].browse(int(param_value)) + price = pricelist._get_product_price(self, 1) + return price + + @api.model + def get_price_public(self): + pricelist = self.env.ref("product.list0") + price = pricelist._get_product_price(self, 1) + return price diff --git a/product_print_category_supermarket/models/product_template_tag.py b/product_print_category_supermarket/models/product_template_tag.py new file mode 100644 index 0000000..29fa833 --- /dev/null +++ b/product_print_category_supermarket/models/product_template_tag.py @@ -0,0 +1,7 @@ +from odoo import fields, models + + +class ProductTemplateTag(models.Model): + _inherit = "product.template.tag" + + image = fields.Image("Logo") diff --git a/product_print_category_supermarket/models/res_config.py b/product_print_category_supermarket/models/res_config.py new file mode 100644 index 0000000..a5d8220 --- /dev/null +++ b/product_print_category_supermarket/models/res_config.py @@ -0,0 +1,12 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + label_pricelist = fields.Many2one( + required=False, + comodel_name="product.pricelist", + string="Pricelist for members", + config_parameter="report_label_supermarket.label_pricelist", + ) diff --git a/product_print_category_supermarket/static/css/pricetag_60x30mm.scss b/product_print_category_supermarket/static/css/pricetag_60x30mm.scss new file mode 100644 index 0000000..27ab688 --- /dev/null +++ b/product_print_category_supermarket/static/css/pricetag_60x30mm.scss @@ -0,0 +1,74 @@ +.pricetag_container{ + height: 3.7cm; + width: 7.1cm; + border: 2px solid black; + text-align: left; + margin: 10; + padding: 0; + position: relative; + display: inline-table; + overflow: hidden; +} + +.product_name { + font-size: 1em; + font-weight: bold; + position: absolute; + margin-top: 1mm; + margin-left: 1mm; + text-align: left; +} + +.product_code { + font-size: 0.8em; + position: absolute; + margin-top: 1.2cm; + margin-left: 5.3cm; + text-align: left; +} + +.product_state { + font-size: 0.8em; + position: absolute; + margin-top: 1.7cm; + right: 0.3cm; + text-align: right; +} + +.product_labels { + vertical-align:bottom; + position: absolute; + margin-top: 2cm; + margin-left: 0.1cm; + width: 35%; + + img { + height: 1cm; + width: 1cm; + float: left; + padding: 0.5mm + } +} + +.product_member_price { + font-size: 1.1em; + position: absolute; + width: 58%; + text-align: right; + margin-top: 2.2cm; + margin-left: 2.8cm; + padding-right: 0.2cm; + background-color: green; + color: white; +} + +.product_public_price { + font-size: 1em; + position: absolute; + width: 58%; + margin-top: 2.9cm; + margin-left: 2.8cm; + text-align: right; + padding-right: 0.2cm; + +} diff --git a/product_print_category_supermarket/views/product_template.xml b/product_print_category_supermarket/views/product_template.xml new file mode 100644 index 0000000..5929cd7 --- /dev/null +++ b/product_print_category_supermarket/views/product_template.xml @@ -0,0 +1,37 @@ + + + + product.template.origin.form (in report_label_supermarket) + product.template + + + + + + + + + + + + + view.product.search.form.inherit.updated + product.template + + + + + + + + + diff --git a/product_print_category_supermarket/views/product_template_tag.xml b/product_print_category_supermarket/views/product_template_tag.xml new file mode 100644 index 0000000..15fcab7 --- /dev/null +++ b/product_print_category_supermarket/views/product_template_tag.xml @@ -0,0 +1,27 @@ + + + + product.template.tag.image.form (in report_label_supermarket) + product.template.tag + + + + + + + + + + + Product Tags + + + + + + diff --git a/product_print_category_supermarket/views/report_pricetag_normal.xml b/product_print_category_supermarket/views/report_pricetag_normal.xml new file mode 100644 index 0000000..ac15d03 --- /dev/null +++ b/product_print_category_supermarket/views/report_pricetag_normal.xml @@ -0,0 +1,43 @@ + + + + + + diff --git a/product_print_category_supermarket/views/res_config.xml b/product_print_category_supermarket/views/res_config.xml new file mode 100644 index 0000000..bd0e752 --- /dev/null +++ b/product_print_category_supermarket/views/res_config.xml @@ -0,0 +1,24 @@ + + + + + product.print.supermarket.res.config.settings.form + res.config.settings + + + + +
+
+
+
+
+
+
+
+