Initial commit
This commit is contained in:
4
garazd_product_label/models/__init__.py
Normal file
4
garazd_product_label/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from . import res_config_settings
|
||||
from . import product_template
|
||||
from . import product_product
|
||||
from . import print_label_type
|
||||
11
garazd_product_label/models/print_label_type.py
Normal file
11
garazd_product_label/models/print_label_type.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class PrintLabelTypePy(models.Model):
|
||||
_name = "print.label.type"
|
||||
_description = 'Label Types'
|
||||
|
||||
name = fields.Char(required=True, translate=True)
|
||||
code = fields.Char(required=True)
|
||||
|
||||
_sql_constraints = [('print_label_type_code_uniq', 'UNIQUE (code)', 'Code of a print label type must be unique.')]
|
||||
13
garazd_product_label/models/product_product.py
Normal file
13
garazd_product_label/models/product_product.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = "product.product"
|
||||
|
||||
def action_open_label_layout(self):
|
||||
# flake8: noqa: E501
|
||||
if not self.env['ir.config_parameter'].sudo().get_param('garazd_product_label.replace_standard_wizard'):
|
||||
return super(ProductProduct, self).action_open_label_layout()
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('garazd_product_label.action_print_label_from_product')
|
||||
action['context'] = {'default_product_product_ids': self.ids}
|
||||
return action
|
||||
13
garazd_product_label/models/product_template.py
Normal file
13
garazd_product_label/models/product_template.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
def action_open_label_layout(self):
|
||||
# flake8: noqa: E501
|
||||
if not self.env['ir.config_parameter'].sudo().get_param('garazd_product_label.replace_standard_wizard'):
|
||||
return super(ProductTemplate, self).action_open_label_layout()
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('garazd_product_label.action_print_label_from_template')
|
||||
action['context'] = {'default_product_template_ids': self.ids}
|
||||
return action
|
||||
7
garazd_product_label/models/res_config_settings.py
Normal file
7
garazd_product_label/models/res_config_settings.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
replace_standard_wizard = fields.Boolean(config_parameter='garazd_product_label.replace_standard_wizard')
|
||||
Reference in New Issue
Block a user