Browse Source

Update readme, Update models.py

pull/110/head
Juan Carlos Montoya 9 years ago
parent
commit
d42754c5fd
  1. 78
      pos_invoice_reconcile/README.rst
  2. 28
      pos_invoice_reconcile/__init__.py
  3. 29
      pos_invoice_reconcile/__openerp__.py
  4. 28
      pos_invoice_reconcile/models/__init__.py
  5. 53
      pos_invoice_reconcile/models/models.py
  6. BIN
      pos_invoice_reconcile/static/description/icon.png

78
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
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
<https://github.com/OCA/pos/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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Juan Carlos Montoya <jcmontoya@sdi.es>
* Javier García <jgarcia@sdi.es>
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.

28
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 <jcmontoya@sdi.es>
# Javier Garcia <jgarcia@sdi.es>
#
# 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/>.
#
##############################################################################
from . import models
# Copyright 2016 SDI Juan Carlos Montoya <jcmontoya@sdi.es>
# Copyright 2016 SDI Javier Garcia <jgarcia@sdi.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

29
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 <jcmontoya@sdi.es>
# Javier Garcia <jgarcia@sdi.es>
#
# 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 2016 SDI Juan Carlos Montoya <jcmontoya@sdi.es>
# Copyright 2016 SDI Javier Garcia <jgarcia@sdi.es>
# 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
""",

28
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 <jcmontoya@sdi.es>
# Javier Garcia <jgarcia@sdi.es>
#
# 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/>.
#
##############################################################################
from . import models
# Copyright 2016 SDI Juan Carlos Montoya <jcmontoya@sdi.es>
# Copyright 2016 SDI Javier Garcia <jgarcia@sdi.es>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

53
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 <jcmontoya@sdi.es>
# Javier Garcia <jgarcia@sdi.es>
#
# 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/>.
#
##############################################################################
from openerp import models, fields, api
# Copyright 2016 SDI Juan Carlos Montoya <jcmontoya@sdi.es>
# Copyright 2016 SDI Javier Garcia <jgarcia@sdi.es>
# 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

BIN
pos_invoice_reconcile/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

Loading…
Cancel
Save