diff --git a/pos_remove_pos_category/__openerp__.py b/pos_remove_pos_category/__openerp__.py index 5e888038..8e726e14 100644 --- a/pos_remove_pos_category/__openerp__.py +++ b/pos_remove_pos_category/__openerp__.py @@ -31,8 +31,7 @@ 'website': 'https://www.akretion.com', 'data': [ 'point_of_sale_view.xml', - 'views/pos_remove_pos_category.xml', + 'views/pos_category.xml', ], 'installable': True, - 'auto_install': False, } diff --git a/pos_remove_pos_category/product.py b/pos_remove_pos_category/product.py index fdadfe46..7baeb845 100644 --- a/pos_remove_pos_category/product.py +++ b/pos_remove_pos_category/product.py @@ -41,6 +41,14 @@ class ProductTemplate(models.Model): return super(ProductTemplate, self).write(vals) +class ProductCategory(models.Model): + _inherit = 'product.category' + + available_in_pos = fields.Boolean( + string="Available in the Point of Sale", + help="Check if you want this category to appear in Point Of Sale") + + _auto_end_original = models.BaseModel._auto_end diff --git a/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js b/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js index 8664c6cc..4ba579c0 100644 --- a/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js +++ b/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js @@ -27,6 +27,7 @@ openerp.pos_remove_pos_category = function(instance, local) { for (var i = 0 ; i < this.models.length; i++){ if (this.models[i].model == 'pos.category') { this.models[i].model = 'product.category'; + this.models[i].domain = [['available_in_pos', '=', true]]; } } return initialize_original.call(this, session, attributes); diff --git a/pos_remove_pos_category/views/pos_category.xml b/pos_remove_pos_category/views/pos_category.xml new file mode 100644 index 00000000..598589e2 --- /dev/null +++ b/pos_remove_pos_category/views/pos_category.xml @@ -0,0 +1,34 @@ + + + + + + + + product.category + + + 20 + + + + + + + + + product.category + + + + + + + + + + diff --git a/pos_remove_pos_category/views/pos_remove_pos_category.xml b/pos_remove_pos_category/views/pos_remove_pos_category.xml deleted file mode 100644 index 11d499de..00000000 --- a/pos_remove_pos_category/views/pos_remove_pos_category.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - -