diff --git a/beesdoo_product/__init__.py b/beesdoo_product/__init__.py index 0f7cb6b..8d752fb 100644 --- a/beesdoo_product/__init__.py +++ b/beesdoo_product/__init__.py @@ -1,2 +1,3 @@ # -*- coding: utf-8 -*- -import models \ No newline at end of file +import models +import wizard diff --git a/beesdoo_product/__openerp__.py b/beesdoo_product/__openerp__.py index cdf8dd5..c7728aa 100644 --- a/beesdoo_product/__openerp__.py +++ b/beesdoo_product/__openerp__.py @@ -26,8 +26,9 @@ 'data': [ 'data/product_label.xml', 'views/beesdoo_product.xml', + 'wizard/views/label_printing_utils.xml', 'security/ir.model.access.csv', ], # only loaded in demonstration mode 'demo': [], -} \ No newline at end of file +} diff --git a/beesdoo_product/models/beesdoo_product.py b/beesdoo_product/models/beesdoo_product.py index 2ddc770..ff67d7b 100644 --- a/beesdoo_product/models/beesdoo_product.py +++ b/beesdoo_product/models/beesdoo_product.py @@ -21,6 +21,10 @@ class BeesdooProduct(models.Model): total_with_vat_by_unit = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT by Reference Unit") total_deposit = fields.Float(compute='_get_total', store=True, string="Deposit Price") + label_to_be_printed = fields.Boolean('Print label?') + label_last_printed = fields.Datetime('Label last printed on') + + @api.one @api.depends('seller_ids', 'seller_ids.date_start') def _compute_main_seller_id(self): diff --git a/beesdoo_product/views/beesdoo_product.xml b/beesdoo_product/views/beesdoo_product.xml index 6b87f5e..bbf2199 100644 --- a/beesdoo_product/views/beesdoo_product.xml +++ b/beesdoo_product/views/beesdoo_product.xml @@ -39,6 +39,8 @@ + + diff --git a/beesdoo_product/wizard/__init__.py b/beesdoo_product/wizard/__init__.py new file mode 100644 index 0000000..183e6cc --- /dev/null +++ b/beesdoo_product/wizard/__init__.py @@ -0,0 +1 @@ +import label_printing_utils diff --git a/beesdoo_product/wizard/label_printing_utils.py b/beesdoo_product/wizard/label_printing_utils.py new file mode 100644 index 0000000..c6f6c28 --- /dev/null +++ b/beesdoo_product/wizard/label_printing_utils.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from openerp import models, fields, api + +class RequestLabelPrintingWizard(models.TransientModel): + + _name = 'label.printing.wizard' + + def _get_selected_products(self): + return self.env.context['active_ids'] + + product_ids = fields.Many2many('product.template', default=_get_selected_products) + + + @api.one + def request_printing(self): + self.product_ids.write({'label_to_be_printed' : True}) + + + @api.one + def set_as_printed(self): + self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()}) diff --git a/beesdoo_product/wizard/views/label_printing_utils.xml b/beesdoo_product/wizard/views/label_printing_utils.xml new file mode 100644 index 0000000..1adf79c --- /dev/null +++ b/beesdoo_product/wizard/views/label_printing_utils.xml @@ -0,0 +1,55 @@ + + + + Request Label Printing Wizard + label.printing.wizard + +
+ +
+
+ +
+
+ + + Request Label Printing Wizard + label.printing.wizard + +
+ +
+
+ +
+
+ +