diff --git a/pos_session_report/README.rst b/pos_session_report/README.rst index 8fe3d4eb..a55e0aca 100644 --- a/pos_session_report/README.rst +++ b/pos_session_report/README.rst @@ -2,38 +2,34 @@ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -============== +=========================== Pos Session Report Detailed -============== +=========================== + +This module extents the POS Session Summary functionality, showing detailed +information about the each transaction payments. + +This functionality works better when using together with the module +pos_payment_term, which allows you to sell using various payment terms. + + +.. image:: /pos_session_report/static/description/pos_session_summary_datailed.png -This module extends the functionality of Pos Session Sumary -and to allow you to show detailed informations about pos session Installation ============ -To install this module, you need to: - -#. Do this ... +Normal installation. Configuration ============= -To configure this module, you need to: - -#. Go to ... +No configuration is needed. -.. figure:: path/to/local/image.png - :alt: alternative description - :width: 600 px Usage ===== -To use this module, you need to: - -#. Go to ... - .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} @@ -41,10 +37,7 @@ To use this module, you need to: .. 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 =========== @@ -52,7 +45,11 @@ 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. +help us smashing it by providing a detailed and welcomed `feedback +`_. Credits ======= diff --git a/pos_session_report/i18n/pt_BR.po b/pos_session_report/i18n/pt_BR.po index 3e1c2fb1..af1777d0 100644 --- a/pos_session_report/i18n/pt_BR.po +++ b/pos_session_report/i18n/pt_BR.po @@ -1,13 +1,13 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * pos_journal_report +# * pos_session_report # msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-09-06 18:31+0000\n" -"PO-Revision-Date: 2016-09-06 18:31+0000\n" +"POT-Creation-Date: 2016-12-19 18:50+0000\n" +"PO-Revision-Date: 2016-12-19 18:50+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,138 +15,138 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document -msgid "- Troco" -msgstr "- Troco" - -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Amount" msgstr "Valor" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Closing Date" msgstr "Data de Fechamento" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Currency" msgstr "Moeda" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Date" msgstr "Data" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Difference" msgstr "Diferença" -#. module: pos_journal_report -#: field:report.pos_journal_report.pos_journal_report,display_name:0 +#. module: pos_session_report +#: field:report.pos_session_report.pos_session_report,display_name:0 msgid "Display Name" -msgstr "Display Name" +msgstr "Nome" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Ending Balance" msgstr "Saldo Final" -#. module: pos_journal_report -#: field:report.pos_journal_report.pos_journal_report,id:0 +#. module: pos_session_report +#: field:report.pos_session_report.pos_session_report,id:0 msgid "ID" msgstr "ID" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Journal" msgstr "Diário" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Journal:" msgstr "Diário:" -#. module: pos_journal_report -#: field:report.pos_journal_report.pos_journal_report,__last_update:0 +#. module: pos_session_report +#: field:report.pos_session_report.pos_session_report,__last_update:0 msgid "Last Modified on" -msgstr "Last Modified on" - -#. module: pos_journal_report -#: model:ir.actions.report.xml,name:pos_journal_report.action_report_pos_journal_report -msgid "Mapa da Caixa" -msgstr "Mapa da Caixa" +msgstr "Última Modificação" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Name" msgstr "Nome" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Opening Date" msgstr "Data de Abertura" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Point of Sale" msgstr "Ponto de Venda" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Pos Order" msgstr "Pos Order" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document -msgid "QTD Parcelas" -msgstr "QTD Parcelas" +#. module: pos_session_report +#: model:ir.actions.report.xml,name:pos_session_report.action_report_pos_session_report +msgid "Pos Session Summary Detailed" +msgstr "Pos Session Summary Detailed" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document +msgid "Quantity Payments" +msgstr "Quantidade de Pagamentos" + +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Reference" msgstr "Referência" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Responsible" msgstr "Responsável" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Session Summary:" msgstr "Resumo da sessão :" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Starting Balance" msgstr "Saldo Inicial" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "State" msgstr "Situação" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Statement Summary" msgstr "Resumo declaração" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Status" msgstr "Situação" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document +msgid "Sub Total" +msgstr "Sub Total" + +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Total Transactions" msgstr "Transações Totais" -#. module: pos_journal_report -#: view:website:pos_journal_report.pos_journal_report_document +#. module: pos_session_report +#: view:website:pos_session_report.pos_session_report_document msgid "Total:" msgstr "Total:" diff --git a/pos_session_report/models/__init__.py b/pos_session_report/models/__init__.py deleted file mode 100644 index f1c52160..00000000 --- a/pos_session_report/models/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 KMEE INFORMATICA LTDA () -# Hendrix Costa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import pos_session diff --git a/pos_session_report/models/pos_session.py b/pos_session_report/models/pos_session.py deleted file mode 100644 index 2c8200cd..00000000 --- a/pos_session_report/models/pos_session.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# © 2016 KMEE INFORMATICA LTDA () -# Hendrix Costa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openerp import models, fields - - -class PosSession(models.Model): - _inherit = 'pos.session' - - user_id = fields.Many2one('res.users', - default=lambda self: self.env.user, - string='User') diff --git a/pos_session_report/report/details_pos_session_report.py b/pos_session_report/report/details_pos_session_report.py index cb209785..ac051755 100644 --- a/pos_session_report/report/details_pos_session_report.py +++ b/pos_session_report/report/details_pos_session_report.py @@ -9,46 +9,67 @@ from openerp import models class DetailsPosSessionReport(report_sxw.rml_parse): - def _get_qtd_payments(self, line): + def _get_quantity_payments(self, line): if line.amount < 0: return '' + quantity_payments = 0 + for statement in line.pos_statement_id.statement_ids: + if statement.amount > 0 and statement.statement_id.id == line.\ + statement_id.id: + quantity_payments += 1 + return quantity_payments - for statement_bank_line in line.pos_statement_id.statement_ids: - if statement_bank_line.amount < 0: - return len(line.pos_statement_id.statement_ids)-1 - return len(line.pos_statement_id.statement_ids) + def _get_lines_from_statements_lines(self, line): + stats_ids = [] + for stats in line.pos_statement_id.statement_ids: + if stats.journal_id.id == line.journal_id.id: + stats_ids.append(stats.id) + return stats_ids + + def _get_total_by_statement_line(self, line): + total = 0 + if line.amount < 0: + return line.amount + for stats in line.pos_statement_id.statement_ids: + if stats.journal_id.id == line.journal_id.id and stats.amount > 0: + total += stats.amount + return total def _get_account_bank_statement_lines(self): pos_session_obj = self.pool.get('pos.session').browse( - self.cr, self.uid,self.ids, context='') + self.cr, self.uid, self.ids, context='') statements_lines = [] lines_done = [] for pos_session in pos_session_obj: for statement in pos_session.statement_ids: for line in statement.line_ids: - if (not (line.id in lines_done) or line.amount < 0): - result = { - 'id': line.id, - 'name': line.name, - 'date': line.date, - 'ref': line.ref, - 'amount': line.amount, - 'partner_id': line.partner_id, - 'journal_id': line.journal_id, - 'pos_statement_id': line.pos_statement_id, - 'qtd_payments': self._get_qtd_payments(line) - } - statements_lines.append(result) - if line.amount < 0: - lines_done.append(line.id) - else: - lines_done.extend( - line.pos_statement_id.statement_ids.ids - ) + if not line.amount == 0: + if (not (line.id in lines_done) or line.amount < 0): + result = { + 'id': line.id, + 'name': line.name, + 'date': line.date, + 'ref': line.ref, + 'amount': + self._get_total_by_statement_line(line), + 'sub_total': line.amount, + 'partner_id': line.partner_id, + 'journal_id': line.journal_id, + 'pos_statement_id': line.pos_statement_id, + 'quantity_payments': + self._get_quantity_payments(line) + } + statements_lines.append(result) + if line.amount < 0: + lines_done.append(line.id) + else: + lines_done.extend( + self._get_lines_from_statements_lines(line) + ) lines_sorted = sorted( statements_lines, - key=lambda lines_sorted: lines_sorted['qtd_payments'] + key=lambda lines_sorted: lines_sorted['quantity_payments'] ) return lines_sorted diff --git a/pos_session_report/report/pos_session_report.xml b/pos_session_report/report/pos_session_report.xml index deaf2341..ab82d33d 100644 --- a/pos_session_report/report/pos_session_report.xml +++ b/pos_session_report/report/pos_session_report.xml @@ -112,7 +112,8 @@ Date Pos Order State - QTD Payments + Quantity Payments + Sub Total Amount @@ -135,7 +136,10 @@ - + + + + diff --git a/pos_session_report/static/description/pos_session_summary_datailed.png b/pos_session_report/static/description/pos_session_summary_datailed.png new file mode 100644 index 00000000..3f224984 Binary files /dev/null and b/pos_session_report/static/description/pos_session_summary_datailed.png differ