Browse Source

Merge pull request #41 from akretion/8-categ-visible-in-pos

[IMP] make category visible or not in pos
pull/9/merge
Sylvain LE GAL 9 years ago
parent
commit
00e199ae43
  1. 4
      pos_remove_pos_category/README.rst
  2. 3
      pos_remove_pos_category/__openerp__.py
  3. 45
      pos_remove_pos_category/i18n/fr.po
  4. 30
      pos_remove_pos_category/i18n/pos_remove_pos_category.pot
  5. 11
      pos_remove_pos_category/product.py
  6. 1
      pos_remove_pos_category/static/src/js/pos_remove_pos_category.js
  7. 34
      pos_remove_pos_category/views/pos_category.xml
  8. 10
      pos_remove_pos_category/views/pos_remove_pos_category.xml

4
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

3
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,
}

45
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 <david.beal@akretion.com>\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"

30
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"

11
pos_remove_pos_category/product.py

@ -41,6 +41,17 @@ 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",
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

1
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);

34
pos_remove_pos_category/views/pos_category.xml

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="pos_remove_pos_category assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js"></script>
</xpath>
</template>
<record id="product_category_form_view" model="ir.ui.view">
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<!-- Priority to avoid to break account and logistics fields-->
<field name="priority">20</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='parent']" position="inside">
<field name="available_in_pos"/>
</xpath>
</field>
</record>
<record id="product_category_list_view" model="ir.ui.view">
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='complete_name']" position="after">
<field name="available_in_pos" string="Available in POS"/>
</xpath>
</field>
</record>
</data>
</openerp>

10
pos_remove_pos_category/views/pos_remove_pos_category.xml

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="pos_remove_pos_category assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_remove_pos_category/static/src/js/pos_remove_pos_category.js"></script>
</xpath>
</template>
</data>
</openerp>
Loading…
Cancel
Save