diff --git a/pos_journal_sequence/__init__.py b/pos_journal_sequence/__init__.py new file mode 100644 index 0000000..a7e0b2f --- /dev/null +++ b/pos_journal_sequence/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# POS Journal Sequence module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import account diff --git a/pos_journal_sequence/__openerp__.py b/pos_journal_sequence/__openerp__.py new file mode 100644 index 0000000..7a87b8a --- /dev/null +++ b/pos_journal_sequence/__openerp__.py @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# POS Journal Sequence module for Odoo +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +{ + 'name': 'POS Journal Sequence', + 'version': '0.1', + 'category': 'Point Of Sale', + 'license': 'AGPL-3', + 'summary': 'Order payment buttons in Point of Sale', + 'description': """ +This module adds a field *POS Sequence* on account journals that will +allow you to control the order of the payment buttons in the interface +of the point of sale. It requires a patch on the Javascript code of the +point of sale (cf file odoo-point_of_sale.patch). + +This module has been written by Alexis de Lattre +. + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['point_of_sale'], + 'data': ['pos_journal_sequence_view.xml'], + 'installable': True, +} diff --git a/pos_journal_sequence/account.py b/pos_journal_sequence/account.py new file mode 100644 index 0000000..8290dab --- /dev/null +++ b/pos_journal_sequence/account.py @@ -0,0 +1,31 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Purchase Auto Invoice Method module for OpenERP +# Copyright (C) 2013 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from openerp import models, fields + + +class AccountJournal(models.Model): + _inherit = 'account.journal' + + pos_sequence = fields.Integer( + string='POS Sequence', + help='Sequence used to order Payment buttons in the Point of Sale') diff --git a/pos_journal_sequence/odoo-point_of_sale.patch b/pos_journal_sequence/odoo-point_of_sale.patch new file mode 100644 index 0000000..7b02929 --- /dev/null +++ b/pos_journal_sequence/odoo-point_of_sale.patch @@ -0,0 +1,15 @@ +diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js +index 8e02ddd..b95c113 100644 +--- a/addons/point_of_sale/static/src/js/widgets.js ++++ b/addons/point_of_sale/static/src/js/widgets.js +@@ -90,6 +90,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa + renderElement: function() { + var self = this; + this._super(); ++ // sort cashregisters by pos_sequence ++ this.pos.cashregisters.sort(function(obj1, obj2) { ++ return obj1.journal.pos_sequence - obj2.journal.pos_sequence; ++ }); + + _.each(this.pos.cashregisters,function(cashregister) { + var button = new module.PaypadButtonWidget(self,{ diff --git a/pos_journal_sequence/pos_journal_sequence_view.xml b/pos_journal_sequence/pos_journal_sequence_view.xml new file mode 100644 index 0000000..269060b --- /dev/null +++ b/pos_journal_sequence/pos_journal_sequence_view.xml @@ -0,0 +1,36 @@ + + + + + + + + + pos.sequence.account.journal.form + account.journal + + + + + + + + + + pos.sequence.account.journal.tree.pos.config + pos.config + + + + + + + + + + +