-
-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 category
- Loading branch information
1 parent
0990b2f
commit b3ba988
Showing
15 changed files
with
153 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,5 @@ | ||
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
# -*- 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). | ||
{ | ||
'name': 'POS Remove POS Category', | ||
'version': '8.0.0.1.0', | ||
'author': 'Akretion, Odoo Community Association (OCA)', | ||
'version': '9.0.0.1.0', | ||
'author': 'Akretion, Camptocamp SA, Odoo Community Association (OCA)', | ||
'category': 'Sales Management', | ||
'depends': [ | ||
'point_of_sale', | ||
], | ||
'demo': [], | ||
'website': 'https://www.akretion.com', | ||
'data': [ | ||
'point_of_sale_view.xml', | ||
'views/pos_category.xml', | ||
'views/assets.xml', | ||
'views/pos_view.xml', | ||
'views/pos_category_view.xml', | ||
], | ||
'installable': False, | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import module | ||
from . import product |
21 changes: 2 additions & 19 deletions
21
pos_remove_pos_category/module.py → pos_remove_pos_category/models/module.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
48 changes: 21 additions & 27 deletions
48
pos_remove_pos_category/static/src/js/pos_remove_pos_category.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { | ||
|
||
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); | ||
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){ | ||
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; | ||
} | ||
}); | ||
}; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Oops, something went wrong.