diff --git a/pos_invoice_reconcile/README.rst b/pos_invoice_reconcile/README.rst index 14d2d5c3..5f18cf14 100755 --- a/pos_invoice_reconcile/README.rst +++ b/pos_invoice_reconcile/README.rst @@ -1,4 +1,76 @@ -POS Invoice Reconcile -====================== +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=========================== +POS Invoice Auto Reconcile +=========================== + This module automatically reconciles invoiced orders in POS (when close session) -This module is based in .. _pos_autoreconcile: https://github.com/OCA/pos/pull/27 \ No newline at end of file + +Installation +============ + +Nothing special is needed to install this module. + +Configuration +============= + +No configuration needed. + +Usage +===== + +To use this module, you need to: + +#. Create a invoice POS Order +#. when close session, automatically all invoiced pos_order will be reconcile + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/build/3149796 + +.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt +.. branch is "8.0" for example + +Known issues / Roadmap +====================== + +* ... + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Juan Carlos Montoya +* Javier GarcĂ­a + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/pos_invoice_reconcile/__init__.py b/pos_invoice_reconcile/__init__.py index 06b02a09..d704284d 100755 --- a/pos_invoice_reconcile/__init__.py +++ b/pos_invoice_reconcile/__init__.py @@ -1,24 +1,6 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright : -# (c) 2016 SDI -# Juan Carlos Montoya -# Javier Garcia -# -# 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 models \ No newline at end of file +# Copyright 2016 SDI Juan Carlos Montoya +# Copyright 2016 SDI Javier Garcia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/pos_invoice_reconcile/__openerp__.py b/pos_invoice_reconcile/__openerp__.py index a9c6ce2c..cce4cc17 100755 --- a/pos_invoice_reconcile/__openerp__.py +++ b/pos_invoice_reconcile/__openerp__.py @@ -1,36 +1,17 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright : -# (c) 2016 SDI -# Juan Carlos Montoya -# Javier Garcia -# -# 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 . -# -############################################################################## +# Copyright 2016 SDI Juan Carlos Montoya +# Copyright 2016 SDI Javier Garcia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - "name": "POS Invoice auto reconcile", + "name": "POS Invoice Auto Reconcile", "version": "8.0.0.1.0", "author": "Juan Carlos Montoya," "Javier Garcia," "Odoo Community Association (OCA)", "website": "http://sdi.es", "license": "AGPL-3", - "category": "Accounting", + "category": "POS", 'summary': """ - Automatically Reconcile invoiced POS orders """, diff --git a/pos_invoice_reconcile/models/__init__.py b/pos_invoice_reconcile/models/__init__.py index 06b02a09..d704284d 100755 --- a/pos_invoice_reconcile/models/__init__.py +++ b/pos_invoice_reconcile/models/__init__.py @@ -1,24 +1,6 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright : -# (c) 2016 SDI -# Juan Carlos Montoya -# Javier Garcia -# -# 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 models \ No newline at end of file +# Copyright 2016 SDI Juan Carlos Montoya +# Copyright 2016 SDI Javier Garcia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models diff --git a/pos_invoice_reconcile/models/models.py b/pos_invoice_reconcile/models/models.py index d8a82999..b724b618 100755 --- a/pos_invoice_reconcile/models/models.py +++ b/pos_invoice_reconcile/models/models.py @@ -1,27 +1,9 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright : -# (c) 2016 SDI -# Juan Carlos Montoya -# Javier Garcia -# -# 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, api +# Copyright 2016 SDI Juan Carlos Montoya +# Copyright 2016 SDI Javier Garcia +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, api class PosSession(models.Model): @@ -31,7 +13,7 @@ class PosSession(models.Model): @api.multi def _confirm_orders(self): acc_default = self.env['ir.property'].get( - 'property_account_receivable', 'res.partner') + 'property_account_receivable', 'res.partner') grouped_data = {} # Filter only invoiced pos orders orders = self.order_ids.filtered(lambda o: o.state == "invoiced") @@ -53,16 +35,13 @@ class PosSession(models.Model): continue for line in statement.journal_entry_id.line_id: - if (line.account_id.id == order_account and - line.state == 'valid'): + account_id = line.account_id.id + if account_id == order_account and line.state == 'valid': grouped_data[key].append(line.id) for key, value in grouped_data.iteritems(): for line in order.invoice_id.move_id.line_id: - if (line.partner_id.id == key[0] and - line.account_id.id == key[1] and - (line.debit > 0) == key[2] and - line.state == 'valid'): + if self._check_valid_line(line, key): grouped_data[key].append(line.id) # reconcile invoice @@ -72,8 +51,20 @@ class PosSession(models.Model): context = self._context.copy() context.update({'active_ids': value}) self.env['account.move.line.reconcile'].with_context( - context).trans_rec_reconcile_full() + context).trans_rec_reconcile_full() grouped_data.clear() return super(PosSession, self)._confirm_orders() + + def _check_valid_line(self, line, key): + result = True + if not line.partner_id.id == key[0]: + return False + if not line.account_id.id == key[1]: + return False + if not (line.debit > 0) == key[2]: + return False + if not line.state == 'valid': + return False + return result diff --git a/pos_invoice_reconcile/static/description/icon.png b/pos_invoice_reconcile/static/description/icon.png new file mode 100755 index 00000000..3a0328b5 Binary files /dev/null and b/pos_invoice_reconcile/static/description/icon.png differ