From 6d1576d23ab8b3a7f1a8b754b4c1f889a8d9f913 Mon Sep 17 00:00:00 2001 From: David Beal Date: Thu, 23 Jul 2015 19:27:05 +0200 Subject: [PATCH 1/2] [IMP] make category visible or not in pos --- pos_remove_pos_category/__openerp__.py | 3 +- pos_remove_pos_category/product.py | 8 +++++ .../static/src/js/pos_remove_pos_category.js | 1 + .../views/pos_category.xml | 34 +++++++++++++++++++ .../views/pos_remove_pos_category.xml | 10 ------ 5 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 pos_remove_pos_category/views/pos_category.xml delete mode 100644 pos_remove_pos_category/views/pos_remove_pos_category.xml 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 @@ - - - - - - From 820fdf5d364681a1c4f8c32f0f08854963ef26f6 Mon Sep 17 00:00:00 2001 From: David Beal Date: Fri, 24 Jul 2015 09:40:17 +0200 Subject: [PATCH 2/2] [FIX] translation & doc --- pos_remove_pos_category/README.rst | 4 ++ pos_remove_pos_category/i18n/fr.po | 45 ++++++++++++++++--- .../i18n/pos_remove_pos_category.pot | 30 ++++++++++++- pos_remove_pos_category/product.py | 5 ++- 4 files changed, 75 insertions(+), 9 deletions(-) diff --git a/pos_remove_pos_category/README.rst b/pos_remove_pos_category/README.rst index bc40e518..93c6eb74 100644 --- a/pos_remove_pos_category/README.rst +++ b/pos_remove_pos_category/README.rst @@ -25,6 +25,10 @@ Configuration No configuration is needed just use product categories as standard pos categories. +You may uncheck 'Available in the Point of Sale' field +in regular product categories if you want that a category becomes invisible +in POS. +Children categories will becomes invisible too, whatever their checkbox state. Bug Tracker diff --git a/pos_remove_pos_category/i18n/fr.po b/pos_remove_pos_category/i18n/fr.po index d0394bb8..3eb0223c 100644 --- a/pos_remove_pos_category/i18n/fr.po +++ b/pos_remove_pos_category/i18n/fr.po @@ -1,22 +1,55 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * pos_remove_pos_category +# * pos_remove_pos_category # msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-31 09:05+0000\n" -"PO-Revision-Date: 2015-03-31 09:05+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2015-07-24 07:13+0000\n" +"PO-Revision-Date: 2015-07-24 09:20+0100\n" +"Last-Translator: David BEAL \n" "Language-Team: \n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" +"X-Generator: Poedit 1.7.5\n" + +#. module: pos_remove_pos_category +#: view:product.category:pos_remove_pos_category.product_category_list_view +msgid "Available in POS" +msgstr "Disponible dans le PDV" + +#. module: pos_remove_pos_category +#: field:product.category,available_in_pos:0 +msgid "Available in the Point of Sale" +msgstr "Disponible dans le Point de Vente" + +#. module: pos_remove_pos_category +#: help:product.category,available_in_pos:0 +msgid "" +"Check if you want this category to appear in Point Of Sale.\n" +"If you uncheck, children categories will becomes invisible too, whatever " +"their checkbox state." +msgstr "" +"Cochez si vous voulez que cette catégorie apparaisse dans le Point de " +"Vente.\n" +"Si vous décochez, les catégories enfants deviendront invisible " +"également, quel que soit l'état de leur case à cocher." + +#. module: pos_remove_pos_category +#: model:ir.model,name:pos_remove_pos_category.model_ir_module_module +msgid "Module" +msgstr "Module" + +#. module: pos_remove_pos_category +#: model:ir.model,name:pos_remove_pos_category.model_product_category +msgid "Product Category" +msgstr "Catégorie de Produit" #. module: pos_remove_pos_category #: model:ir.model,name:pos_remove_pos_category.model_product_template msgid "Product Template" msgstr "Modèle d'article" - diff --git a/pos_remove_pos_category/i18n/pos_remove_pos_category.pot b/pos_remove_pos_category/i18n/pos_remove_pos_category.pot index 83e447d8..be5c8f97 100644 --- a/pos_remove_pos_category/i18n/pos_remove_pos_category.pot +++ b/pos_remove_pos_category/i18n/pos_remove_pos_category.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-03-31 09:01+0000\n" -"PO-Revision-Date: 2015-03-31 09:01+0000\n" +"POT-Creation-Date: 2015-07-24 07:13+0000\n" +"PO-Revision-Date: 2015-07-24 07:13+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,32 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: pos_remove_pos_category +#: view:product.category:pos_remove_pos_category.product_category_list_view +msgid "Available in POS" +msgstr "" + +#. module: pos_remove_pos_category +#: field:product.category,available_in_pos:0 +msgid "Available in the Point of Sale" +msgstr "" + +#. module: pos_remove_pos_category +#: help:product.category,available_in_pos:0 +msgid "Check if you want this category to appear in Point Of Sale.\n" +"If you uncheck, children categories will becomes invisible too, whatever their checkbox state." +msgstr "" + +#. module: pos_remove_pos_category +#: model:ir.model,name:pos_remove_pos_category.model_ir_module_module +msgid "Module" +msgstr "" + +#. module: pos_remove_pos_category +#: model:ir.model,name:pos_remove_pos_category.model_product_category +msgid "Product Category" +msgstr "" + #. module: pos_remove_pos_category #: model:ir.model,name:pos_remove_pos_category.model_product_template msgid "Product Template" diff --git a/pos_remove_pos_category/product.py b/pos_remove_pos_category/product.py index 7baeb845..4654d580 100644 --- a/pos_remove_pos_category/product.py +++ b/pos_remove_pos_category/product.py @@ -46,7 +46,10 @@ class ProductCategory(models.Model): 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") + default=True, + help="Check if you want this category to appear in Point Of Sale.\n" + "If you uncheck, children categories will becomes invisible too, " + "whatever their checkbox state.") _auto_end_original = models.BaseModel._auto_end