Browse Source

[FIX] Functions based on account bank statement lines / Fix some questions

pull/122/head
Hendrix Costa 8 years ago
parent
commit
b848495c8d
  1. 39
      pos_session_report/README.rst
  2. 134
      pos_session_report/i18n/pt_BR.po
  3. 6
      pos_session_report/models/__init__.py
  4. 14
      pos_session_report/models/pos_session.py
  5. 73
      pos_session_report/report/details_pos_session_report.py
  6. 8
      pos_session_report/report/pos_session_report.xml
  7. BIN
      pos_session_report/static/description/pos_session_summary_datailed.png

39
pos_session_report/README.rst

@ -2,38 +2,34 @@
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
==============
===========================
Pos Session Report Detailed 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 Installation
============ ============
To install this module, you need to:
#. Do this ...
Normal installation.
Configuration 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 Usage
===== =====
To use this module, you need to:
#. Go to ...
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} :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 .. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
.. branch is "8.0" for example .. branch is "8.0" for example
Known issues / Roadmap
======================
* ...
Bug Tracker Bug Tracker
=========== ===========
@ -52,7 +45,11 @@ Bug Tracker
Bugs are tracked on `GitHub Issues Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please <https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first, 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
<https://github.com/OCA/
pos/issues/new?body=module:%20
pos_session_summary%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits Credits
======= =======

134
pos_session_report/i18n/pt_BR.po

@ -1,13 +1,13 @@
# Translation of Odoo Server. # Translation of Odoo Server.
# This file contains the translation of the following modules: # This file contains the translation of the following modules:
# * pos_journal_report
# * pos_session_report
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 8.0\n" "Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \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" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -15,138 +15,138 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \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" msgid "Amount"
msgstr "Valor" 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" msgid "Closing Date"
msgstr "Data de Fechamento" 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" msgid "Currency"
msgstr "Moeda" 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" msgid "Date"
msgstr "Data" 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" msgid "Difference"
msgstr "Diferença" 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" 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" msgid "Ending Balance"
msgstr "Saldo Final" 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" msgid "ID"
msgstr "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" msgid "Journal"
msgstr "Diário" 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:" msgid "Journal:"
msgstr "Diário:" 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" 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" msgid "Name"
msgstr "Nome" 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" msgid "Opening Date"
msgstr "Data de Abertura" 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" msgid "Point of Sale"
msgstr "Ponto de Venda" 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" msgid "Pos Order"
msgstr "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" msgid "Reference"
msgstr "Referência" 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" msgid "Responsible"
msgstr "Responsável" 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:" msgid "Session Summary:"
msgstr "Resumo da sessão :" 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" msgid "Starting Balance"
msgstr "Saldo Inicial" 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" msgid "State"
msgstr "Situação" 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" msgid "Statement Summary"
msgstr "Resumo declaração" 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" msgid "Status"
msgstr "Situação" 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" msgid "Total Transactions"
msgstr "Transações Totais" 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:" msgid "Total:"
msgstr "Total:" msgstr "Total:"

6
pos_session_report/models/__init__.py

@ -1,6 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 KMEE INFORMATICA LTDA (<http://kmee.com.br>)
# Hendrix Costa <hendrix.costa@kmee.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import pos_session

14
pos_session_report/models/pos_session.py

@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 KMEE INFORMATICA LTDA (<http://kmee.com.br>)
# Hendrix Costa <hendrix.costa@kmee.com.br>
# 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')

73
pos_session_report/report/details_pos_session_report.py

@ -9,46 +9,67 @@ from openerp import models
class DetailsPosSessionReport(report_sxw.rml_parse): class DetailsPosSessionReport(report_sxw.rml_parse):
def _get_qtd_payments(self, line):
def _get_quantity_payments(self, line):
if line.amount < 0: if line.amount < 0:
return '' 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): def _get_account_bank_statement_lines(self):
pos_session_obj = self.pool.get('pos.session').browse( 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 = [] statements_lines = []
lines_done = [] lines_done = []
for pos_session in pos_session_obj: for pos_session in pos_session_obj:
for statement in pos_session.statement_ids: for statement in pos_session.statement_ids:
for line in statement.line_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( lines_sorted = sorted(
statements_lines, statements_lines,
key=lambda lines_sorted: lines_sorted['qtd_payments']
key=lambda lines_sorted: lines_sorted['quantity_payments']
) )
return lines_sorted return lines_sorted

8
pos_session_report/report/pos_session_report.xml

@ -112,7 +112,8 @@
<th>Date</th> <th>Date</th>
<th>Pos Order</th> <th>Pos Order</th>
<th>State</th> <th>State</th>
<th>QTD Payments</th>
<th>Quantity Payments</th>
<th>Sub Total</th>
<th class="text-right">Amount</th> <th class="text-right">Amount</th>
</tr> </tr>
</thead> </thead>
@ -135,7 +136,10 @@
<span t-esc="bank_statement_line['pos_statement_id'].state"/> <span t-esc="bank_statement_line['pos_statement_id'].state"/>
</td> </td>
<td> <td>
<span t-esc="bank_statement_line['qtd_payments']"/>
<span t-esc="bank_statement_line['quantity_payments']"/>
</td>
<td>
<span t-esc="bank_statement_line['sub_total']"/>
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-esc="bank_statement_line['amount']"/> <span t-esc="bank_statement_line['amount']"/>

BIN
pos_session_report/static/description/pos_session_summary_datailed.png

After

Width: 793  |  Height: 554  |  Size: 55 KiB

Loading…
Cancel
Save