diff --git a/customized_barcode_generator/README.rst b/customized_barcode_generator/README.rst new file mode 100644 index 000000000..74e962639 --- /dev/null +++ b/customized_barcode_generator/README.rst @@ -0,0 +1,13 @@ +Cost Price as Code in Barcode v12 +================================= + + The module enables user to print customized product labels. + +Installation +============ + - www.odoo.com/documentation/12.0/setup/install.html + - Install our custom addon + +Credits +======= + Developer: Atul Ramesh Varma @ cybrosys, Contact: odoo@cybrosys.com diff --git a/customized_barcode_generator/__init__.py b/customized_barcode_generator/__init__.py new file mode 100644 index 000000000..4fcf7385c --- /dev/null +++ b/customized_barcode_generator/__init__.py @@ -0,0 +1,2 @@ +from . import report +from . import models \ No newline at end of file diff --git a/customized_barcode_generator/__manifest__.py b/customized_barcode_generator/__manifest__.py new file mode 100644 index 000000000..296947e34 --- /dev/null +++ b/customized_barcode_generator/__manifest__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +{ + 'name': 'Cost Price as Code in Barcode', + 'version': '12.0.1.0.0', + 'summary': """Print user defined product labels.""", + 'description': """The module enables user to print customized product labels. + """, + 'category': 'Tools', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['base', 'web', 'product','account'], + 'website': 'https://www.cybrosys.com', + 'data': [ + 'report/product_label_template.xml', + 'views/barcode_generator_view.xml', + 'security/ir.model.access.csv' + ], + 'qweb': [], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/customized_barcode_generator/doc/RELEASE_NOTES.md b/customized_barcode_generator/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..b38c396aa --- /dev/null +++ b/customized_barcode_generator/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 13.02.2019 +#### Version 12.0.1.0.0 +##### ADD +- Initial commit for Customized Barcode Generator diff --git a/customized_barcode_generator/models/__init__.py b/customized_barcode_generator/models/__init__.py new file mode 100644 index 000000000..1116085dc --- /dev/null +++ b/customized_barcode_generator/models/__init__.py @@ -0,0 +1 @@ +from . import barcode_generator \ No newline at end of file diff --git a/customized_barcode_generator/models/barcode_generator.py b/customized_barcode_generator/models/barcode_generator.py new file mode 100644 index 000000000..e29336981 --- /dev/null +++ b/customized_barcode_generator/models/barcode_generator.py @@ -0,0 +1,113 @@ +from odoo import api, fields, models, _ +import datetime +from odoo.exceptions import UserError + + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + active_standard_price = fields.Boolean(string='Standard price as a code', + help="check this box to show cost on the product labels as code") + active_ref = fields.Boolean(string='Show product reference ', + help="check this box to show product reference as in product labels") + + @api.model + def get_values(self): + res = super(ResConfigSettings, self).get_values() + params = self.env['ir.config_parameter'].sudo() + active_standard_price = params.get_param('active_standard_price', default=False) + active_ref = params.get_param('active_ref', default=False) + res.update( + active_standard_price=bool(active_standard_price), + active_ref=bool(active_ref), + ) + return res + + @api.multi + def set_values(self): + super(ResConfigSettings, self).set_values() + self.env['ir.config_parameter'].sudo().set_param("active_standard_price", + self.active_standard_price) + self.env['ir.config_parameter'].sudo().set_param("active_ref", + self.active_ref) + + +class CustomizeBarcodeGenerator(models.Model): + _name = 'barcode.code' + name = fields.Char(default='Numeric Code') + code_for_zero = fields.Char(string=' 0 ', required=True, limit=1, size=1, + default='a', help="insert substitute code ") + code_for_one = fields.Char(string='1 ', required=True, limit=1, size=1, + default='b', help="insert substitute code ") + code_for_two = fields.Char(string='2 ', required=True, limit=1, size=1, + default='c', help="insert substitute code ") + code_for_three = fields.Char(string='3 ', required=True, limit=1, size=1, + default='d', help="insert substitute code ") + code_for_four = fields.Char(string='4 ', required=True, limit=1, size=1, + default='e', help="insert substitute code ") + code_for_five = fields.Char(string='5 ', required=True, limit=1, size=1, + default='f', help="insert substitute code ") + code_for_six = fields.Char(string='6 ', required=True, limit=1, size=1, + default='g', help="insert substitute code ") + code_for_seven = fields.Char(string='7 ', required=True, limit=1, size=1, + default='h', help="insert substitute code ") + code_for_eight = fields.Char(string='8 ', required=True, limit=1, size=1, + default='i', help="insert substitute code ") + code_for_nine = fields.Char(string='9 ', required=True, limit=1, size=1, + default='j', help="insert substitute code ") + active_check = fields.Boolean(string="Active", default=False) + date_check = fields.Datetime(default=datetime.datetime.today(), string="Date") + + @api.multi + @api.onchange('active_check') + def onchange_active_check(self): + for i in self.search([]): + if i.active_check == self.active_check and self.active_check: + self.active_check = False + raise UserError(_("Only one rule for code can be active at a time")) + + +class CostToCode(models.Model): + _inherit = 'product.product' + cost_in_code = fields.Char(string='Cost in code', compute='get_cost_in_code') + + @api.multi + def get_cost_in_code(self): + code = self.env['barcode.code'].sudo().search([('active_check', '=', True)]) + active_check = self.env['ir.config_parameter'].sudo().search([('key','=','active_standard_price'),('value','=',True)]) + if active_check: + if code: + real = str(self.standard_price).split('.')[0] + for i in real: + if i == '0': + real = real.replace('0', code.code_for_zero) + elif i == '1': + real = real.replace('1', code.code_for_one) + elif i == '2': + real = real.replace('2', code.code_for_two) + elif i == '3': + real = real.replace('3', code.code_for_three) + elif i == '4': + real = real.replace('4', code.code_for_four) + elif i == '5': + real = real.replace('5', code.code_for_five) + elif i == '6': + real = real.replace('6', code.code_for_six) + elif i == '7': + real = real.replace('7', code.code_for_seven) + elif i == '8': + real = real.replace('8', code.code_for_eight) + else: + real = real.replace('9', code.code_for_nine) + return real + else: + return " " + else: + return " " + + def get_product_ref(self): + active_check = self.env['ir.config_parameter'].sudo().search([('key','=','active_ref'),('value','=',True)]) + if active_check: + return self.default_code + else: + return " " diff --git a/customized_barcode_generator/report/__init__.py b/customized_barcode_generator/report/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/customized_barcode_generator/report/product_label_template.xml b/customized_barcode_generator/report/product_label_template.xml new file mode 100644 index 000000000..169b60346 --- /dev/null +++ b/customized_barcode_generator/report/product_label_template.xml @@ -0,0 +1,80 @@ + + + + + + \ No newline at end of file diff --git a/customized_barcode_generator/security/ir.model.access.csv b/customized_barcode_generator/security/ir.model.access.csv new file mode 100644 index 000000000..947b82bf7 --- /dev/null +++ b/customized_barcode_generator/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_customized_barcode_generator,customized.barcode.generator.user,model_barcode_code,account.group_account_manager,1,1,1,1 \ No newline at end of file diff --git a/customized_barcode_generator/static/description/banner.jpg b/customized_barcode_generator/static/description/banner.jpg new file mode 100644 index 000000000..65fc16823 Binary files /dev/null and b/customized_barcode_generator/static/description/banner.jpg differ diff --git a/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodeform-cybrosys.png b/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodeform-cybrosys.png new file mode 100644 index 000000000..f98ae33cf Binary files /dev/null and b/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodeform-cybrosys.png differ diff --git a/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodetree-cybrosys.png b/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodetree-cybrosys.png new file mode 100644 index 000000000..f0e82ea48 Binary files /dev/null and b/customized_barcode_generator/static/description/customized-barcode-generator-barcodecodetree-cybrosys.png differ diff --git a/customized_barcode_generator/static/description/customized-barcode-generator-productlabelpdf-cybrosys.png b/customized_barcode_generator/static/description/customized-barcode-generator-productlabelpdf-cybrosys.png new file mode 100644 index 000000000..ac5200892 Binary files /dev/null and b/customized_barcode_generator/static/description/customized-barcode-generator-productlabelpdf-cybrosys.png differ diff --git a/customized_barcode_generator/static/description/customized-barcode-generator-productlabelprint-cybrosys.png b/customized_barcode_generator/static/description/customized-barcode-generator-productlabelprint-cybrosys.png new file mode 100644 index 000000000..ea685e726 Binary files /dev/null and b/customized_barcode_generator/static/description/customized-barcode-generator-productlabelprint-cybrosys.png differ diff --git a/customized_barcode_generator/static/description/customized-barcode-generator-settings-cybrosys.png b/customized_barcode_generator/static/description/customized-barcode-generator-settings-cybrosys.png new file mode 100644 index 000000000..0efdf8231 Binary files /dev/null and b/customized_barcode_generator/static/description/customized-barcode-generator-settings-cybrosys.png differ diff --git a/customized_barcode_generator/static/description/icon.png b/customized_barcode_generator/static/description/icon.png new file mode 100644 index 000000000..24f01cebb Binary files /dev/null and b/customized_barcode_generator/static/description/icon.png differ diff --git a/customized_barcode_generator/static/description/index.html b/customized_barcode_generator/static/description/index.html new file mode 100644 index 000000000..8997510c2 --- /dev/null +++ b/customized_barcode_generator/static/description/index.html @@ -0,0 +1,325 @@ + +
+
+

+ Customized Barcode Generator +

+

+ Print user defined product labels. +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+ +
+
+

+ Overview +

+

+ The module enables user to print customized product labels. +

+
+
+ +
+
+

+ Features +

+

+ + Create custom code for printing standard price on product labels. +

+

+ + Show/hide product reference on product labels. +

+

+ + Show/hide cost price as a code on product labels. +

+
+
+ +
+
+

+ Screenshots +

+

+ + Go to Invoicing --> Settings.
+      Select whether to show/hide standard price as code or product reference on product labels and click Save.
+

+
+ +
+

+ + Go to Invoicing --> Settings --> Product Labels. Click on barcode code to create a new rules.
+

+
+ +
+

+ + In the form view, you can set the code for each digit. Click on the active button to use this rule on the product label. +

+
+ +
+

+ + Go to Products view select products and print product labels as shown below
+

+
+ +
+

+ + You can see the standard price of products on the bottom right of product label as code using the active rule, and at the bottom left you can see the product reference. +

+
+ +
+
+
+
+
+ cybrosys technologies +
+
+ +
+
+

+ Our Services +

+
+
+
+ + + + +
+

+ Odoo Customization +

+
+
+
+ + + +
+

+ Odoo Implementation +

+
+
+
+ + + +
+

+ Odoo Integration +

+
+
+
+ + + +
+

+ Odoo Support +

+
+
+
+ + + +
+

+ Hire Odoo Developers +

+ +
+
+
+
+
+
+

+ Our Industries +

+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Trading +

+

+ Easily procure and sell your products. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ POS +

+

+ Easy configuring and convivial selling. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+
+
+ + Odoo Industry + +
+
+
+

+ Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+ +
+ +
+ diff --git a/customized_barcode_generator/views/barcode_generator_view.xml b/customized_barcode_generator/views/barcode_generator_view.xml new file mode 100644 index 000000000..ab6d0eec3 --- /dev/null +++ b/customized_barcode_generator/views/barcode_generator_view.xml @@ -0,0 +1,88 @@ + + + + + barcode.code.form.view + barcode.code + form + +
+ + +
+
+
+ + barcode.code.tree.view + barcode.code + tree + + + + + + + + + + + Barcode Code + barcode.code + form + tree,form + +

Create new code +

+
+
+ + res.config.settings.view.form.customize.barcode + res.config.settings + + + + +

Product Labels

+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
\ No newline at end of file