Browse Source
[9.0][MIG] pos_remove_pos_category (#148)
[9.0][MIG] pos_remove_pos_category (#148)
* migrate to v9 and add italian translation * short headers * migrate JS * [fix] be defensive: do not assume we have a product categorypull/113/merge
Simone Orsi
8 years ago
committed by
Sylvain LE GAL
15 changed files with 153 additions and 175 deletions
-
1pos_remove_pos_category/README.rst
-
24pos_remove_pos_category/__init__.py
-
33pos_remove_pos_category/__openerp__.py
-
2pos_remove_pos_category/i18n/fr.po
-
54pos_remove_pos_category/i18n/it.po
-
3pos_remove_pos_category/i18n/pos_remove_pos_category.pot
-
2pos_remove_pos_category/models/__init__.py
-
21pos_remove_pos_category/models/module.py
-
24pos_remove_pos_category/models/product.py
-
19pos_remove_pos_category/point_of_sale_view.xml
-
48pos_remove_pos_category/static/src/js/pos_remove_pos_category.js
-
9pos_remove_pos_category/views/assets.xml
-
41pos_remove_pos_category/views/pos_category.xml
-
30pos_remove_pos_category/views/pos_category_view.xml
-
17pos_remove_pos_category/views/pos_view.xml
@ -1,23 +1,5 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
############################################################################## |
|
||||
# |
|
||||
# OpenERP, Open Source Management Solution |
|
||||
# Copyright (C) 2015-TODAY Akretion (<http://www.akretion.com>). |
|
||||
# |
|
||||
# This program is free software: you can redistribute it and/or modify |
|
||||
# it under the terms of the GNU Affero General Public License as |
|
||||
# published by the Free Software Foundation, either version 3 of the |
|
||||
# License, or (at your option) any later version. |
|
||||
# |
|
||||
# This program is distributed in the hope that it will be useful, |
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
# GNU Affero General Public License for more details. |
|
||||
# |
|
||||
# You should have received a copy of the GNU Affero General Public License |
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# Copyright (C) 2015-TODAY Akretion (<http://www.akretion.com>). |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from . import product |
|
||||
from . import module |
|
||||
|
from . import models |
@ -0,0 +1,54 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * pos_remove_pos_category |
||||
|
# |
||||
|
msgid "" |
||||
|
msgstr "" |
||||
|
"Project-Id-Version: Odoo Server 9.0\n" |
||||
|
"Report-Msgid-Bugs-To: \n" |
||||
|
"POT-Creation-Date: 2015-07-24 07:13+0000\n" |
||||
|
"PO-Revision-Date: 2017-01-23 13:13+0100\n" |
||||
|
"Last-Translator: Simone Orsi <simone.orsi@camptocamp.com>\n" |
||||
|
"Language-Team: \n" |
||||
|
"Language: it\n" |
||||
|
"MIME-Version: 1.0\n" |
||||
|
"Content-Type: text/plain; charset=UTF-8\n" |
||||
|
"Content-Transfer-Encoding: 8bit\n" |
||||
|
"Plural-Forms: \n" |
||||
|
"X-Generator: Poedit 1.8.9\n" |
||||
|
|
||||
|
#. module: pos_remove_pos_category |
||||
|
#: view:product.category:pos_remove_pos_category.product_category_list_view |
||||
|
msgid "Available in POS" |
||||
|
msgstr "Disponibile nel POS" |
||||
|
|
||||
|
#. module: pos_remove_pos_category |
||||
|
#: field:product.category,available_in_pos:0 |
||||
|
msgid "Available in the Point of Sale" |
||||
|
msgstr "Disponibile nel POS" |
||||
|
|
||||
|
#. 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 "" |
||||
|
"Attiva per far apparire questa categoria nel POS.\n" |
||||
|
"Se disattivato, anche le sotto-categorie saranno nascoste, anche se " |
||||
|
"attivate singolarmente." |
||||
|
|
||||
|
#. 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 "Categoria Prodotto" |
||||
|
|
||||
|
#. module: pos_remove_pos_category |
||||
|
#: model:ir.model,name:pos_remove_pos_category.model_product_template |
||||
|
msgid "Product Template" |
||||
|
msgstr "Template Prodotto" |
@ -0,0 +1,2 @@ |
|||||
|
from . import module |
||||
|
from . import product |
@ -1,23 +1,6 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
############################################################################## |
|
||||
# |
|
||||
# OpenERP, Open Source Management Solution |
|
||||
# Copyright (C) 2015-TODAY Akretion (<http://www.akretion.com>). |
|
||||
# |
|
||||
# This program is free software: you can redistribute it and/or modify |
|
||||
# it under the terms of the GNU Affero General Public License as |
|
||||
# published by the Free Software Foundation, either version 3 of the |
|
||||
# License, or (at your option) any later version. |
|
||||
# |
|
||||
# This program is distributed in the hope that it will be useful, |
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
# GNU Affero General Public License for more details. |
|
||||
# |
|
||||
# You should have received a copy of the GNU Affero General Public License |
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||
# |
|
||||
############################################################################## |
|
||||
|
# Copyright (C) 2015-TODAY Akretion (<http://www.akretion.com>). |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
from openerp import models |
from openerp import models |
||||
|
|
@ -1,19 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
<record id="product_template_form_view" model="ir.ui.view"> |
|
||||
<field name="name">product.template.form.inherit</field> |
|
||||
<field name="model">product.template</field> |
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/> |
|
||||
<field name="priority" eval="100"/> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="pos_categ_id" position="attributes"> |
|
||||
<attribute name="invisible">1</attribute> |
|
||||
</field> |
|
||||
</field> |
|
||||
</record> |
|
||||
<record id="point_of_sale.product_pos_category_action" model="ir.actions.act_window"> |
|
||||
<field name="res_model">product.category</field> |
|
||||
</record> |
|
||||
</data> |
|
||||
</openerp> |
|
@ -1,44 +1,38 @@ |
|||||
/****************************************************************************** |
/****************************************************************************** |
||||
* Point Of Sale - Pricelist for POS Odoo |
|
||||
* Copyright (C) 2015-TODAY Akretion (http://www.akretion.com)
|
|
||||
* @author Sylvain Calador <sylvain.calador@akretion.com> |
|
||||
* |
|
||||
* This program is free software: you can redistribute it and/or modify |
|
||||
* it under the terms of the GNU Affero General Public License as |
|
||||
* published by the Free Software Foundation, either version 3 of the |
|
||||
* License, or (at your option) any later version. |
|
||||
* This program is distributed in the hope that it will be useful, |
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
* GNU Affero General Public License for more details. |
|
||||
* You should have received a copy of the GNU Affero General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
* |
|
||||
|
* Copyright (C) 2015-2016 Akretion (<http://www.akretion.com>).
|
||||
|
* Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>).
|
||||
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
******************************************************************************/ |
******************************************************************************/ |
||||
|
|
||||
openerp.pos_remove_pos_category = function(instance, local) { |
|
||||
module = instance.point_of_sale; |
|
||||
|
odoo.define('pos_remove_pos_category.remove_pos_category', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
var initialize_original = module.PosModel.prototype.initialize; |
|
||||
module.PosModel = module.PosModel.extend({ |
|
||||
|
var core = require('web.core'); |
||||
|
var pos_models = require('point_of_sale.models'); |
||||
|
var pos_screens = require('point_of_sale.screens'); |
||||
|
var Model = require('web.DataModel'); |
||||
|
var _t = core._t; |
||||
|
|
||||
|
var _pos_super = pos_models.PosModel.prototype; |
||||
|
pos_models.PosModel = pos_models.PosModel.extend({ |
||||
initialize: function(session, attributes) { |
initialize: function(session, attributes) { |
||||
|
|
||||
for (var i = 0 ; i < this.models.length; i++){ |
for (var i = 0 ; i < this.models.length; i++){ |
||||
if (this.models[i].model == 'pos.category') { |
if (this.models[i].model == 'pos.category') { |
||||
this.models[i].model = 'product.category'; |
this.models[i].model = 'product.category'; |
||||
this.models[i].domain = [['available_in_pos', '=', true]]; |
this.models[i].domain = [['available_in_pos', '=', true]]; |
||||
} |
} |
||||
} |
} |
||||
return initialize_original.call(this, session, attributes); |
|
||||
|
return _pos_super.initialize.apply(this, arguments); |
||||
} |
} |
||||
}); |
|
||||
|
}); |
||||
|
|
||||
//override method js POS (widgets.js)
|
|
||||
//change pos.category by product.category
|
|
||||
module.ProductCategoriesWidget = module.ProductCategoriesWidget.extend({ |
|
||||
|
// override method js POS (widgets.js)
|
||||
|
// change pos.category by product.category
|
||||
|
pos_screens.ProductCategoriesWidget.include({ |
||||
get_image_url: function(category){ |
get_image_url: function(category){ |
||||
return window.location.origin + '/web/binary/image?model=product.category&field=image_medium&id='+category.id; |
|
||||
|
var image_url = '/web/binary/image?model=product.category&field=image_medium&id='; |
||||
|
return window.location.origin + image_url + category.id; |
||||
} |
} |
||||
}); |
}); |
||||
}; |
|
||||
|
|
||||
|
}); |
@ -0,0 +1,9 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<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> |
||||
|
</odoo> |
@ -1,41 +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> |
|
||||
|
|
||||
<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 name="name" position="after"> |
|
||||
<div class="oe_bottom" style="margin-top: 10px;"> |
|
||||
<field name="image_medium" |
|
||||
widget="image" |
|
||||
class="oe_left oe_avatar" |
|
||||
options='{"size": [100, 100]}'/> |
|
||||
</div> |
|
||||
</field> |
|
||||
</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> |
|
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<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"> |
||||
|
<field name="type" position="after"> |
||||
|
<field name="available_in_pos"/> |
||||
|
</field> |
||||
|
<xpath expr="//div[contains(@class,'oe_title')]" position="before"> |
||||
|
<field name="image_medium" |
||||
|
widget="image" |
||||
|
class="oe_avatar" |
||||
|
options='{"size": [100, 100]}'/> |
||||
|
</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> |
||||
|
</odoo> |
@ -0,0 +1,17 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<record id="product_template_form_view" model="ir.ui.view"> |
||||
|
<field name="name">product.template.form.inherit</field> |
||||
|
<field name="model">product.template</field> |
||||
|
<field name="inherit_id" ref="product.product_template_form_view"/> |
||||
|
<field name="priority" eval="100"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="pos_categ_id" position="attributes"> |
||||
|
<attribute name="invisible">1</attribute> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
<record id="point_of_sale.product_pos_category_action" model="ir.actions.act_window"> |
||||
|
<field name="res_model">product.category</field> |
||||
|
</record> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue