Hendrix Costa
8 years ago
9 changed files with 541 additions and 0 deletions
-
84pos_session_report/README.rst
-
6pos_session_report/__init__.py
-
21pos_session_report/__openerp__.py
-
152pos_session_report/i18n/pt_BR.po
-
6pos_session_report/models/__init__.py
-
14pos_session_report/models/pos_session.py
-
6pos_session_report/report/__init__.py
-
68pos_session_report/report/details_pos_session_report.py
-
184pos_session_report/report/pos_session_report.xml
@ -0,0 +1,84 @@ |
|||
.. 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 Session Report Detailed |
|||
============== |
|||
|
|||
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 ... |
|||
|
|||
Configuration |
|||
============= |
|||
|
|||
To configure this module, you need to: |
|||
|
|||
#. Go to ... |
|||
|
|||
.. 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} |
|||
|
|||
.. 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/{project_repo}/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 |
|||
------------ |
|||
|
|||
* Hendrix Costa <hendrix.costa@kmee.com.br> |
|||
|
|||
|
|||
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. |
@ -0,0 +1,6 @@ |
|||
# -*- 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 report |
@ -0,0 +1,21 @@ |
|||
# -*- 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). |
|||
|
|||
{ |
|||
"name": "Point of Sale - Session Detailed Report", |
|||
"version": "8.0.1.0.0", |
|||
"author": "KMEE INFORMATICA LTDA, " |
|||
"Odoo Community Association (OCA)", |
|||
'website': 'http://odoo-brasil.org', |
|||
"license": "AGPL-3", |
|||
"category": "Point Of Sale", |
|||
"depends": [ |
|||
'point_of_sale', |
|||
], |
|||
'data': [ |
|||
"report/pos_session_report.xml", |
|||
], |
|||
"installable": True, |
|||
} |
@ -0,0 +1,152 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_journal_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" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"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 |
|||
msgid "Amount" |
|||
msgstr "Valor" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Closing Date" |
|||
msgstr "Data de Fechamento" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Currency" |
|||
msgstr "Moeda" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Date" |
|||
msgstr "Data" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Difference" |
|||
msgstr "Diferença" |
|||
|
|||
#. module: pos_journal_report |
|||
#: field:report.pos_journal_report.pos_journal_report,display_name:0 |
|||
msgid "Display Name" |
|||
msgstr "Display Name" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Ending Balance" |
|||
msgstr "Saldo Final" |
|||
|
|||
#. module: pos_journal_report |
|||
#: field:report.pos_journal_report.pos_journal_report,id:0 |
|||
msgid "ID" |
|||
msgstr "ID" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Journal" |
|||
msgstr "Diário" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Journal:" |
|||
msgstr "Diário:" |
|||
|
|||
#. module: pos_journal_report |
|||
#: field:report.pos_journal_report.pos_journal_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" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Name" |
|||
msgstr "Nome" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Opening Date" |
|||
msgstr "Data de Abertura" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Point of Sale" |
|||
msgstr "Ponto de Venda" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_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_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Reference" |
|||
msgstr "Referência" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Responsible" |
|||
msgstr "Responsável" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Session Summary:" |
|||
msgstr "Resumo da sessão :" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Starting Balance" |
|||
msgstr "Saldo Inicial" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "State" |
|||
msgstr "Situação" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Statement Summary" |
|||
msgstr "Resumo declaração" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Status" |
|||
msgstr "Situação" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Total Transactions" |
|||
msgstr "Transações Totais" |
|||
|
|||
#. module: pos_journal_report |
|||
#: view:website:pos_journal_report.pos_journal_report_document |
|||
msgid "Total:" |
|||
msgstr "Total:" |
|||
|
@ -0,0 +1,6 @@ |
|||
# -*- 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 |
@ -0,0 +1,14 @@ |
|||
# -*- 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') |
@ -0,0 +1,6 @@ |
|||
# -*- 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 details_pos_session_report |
@ -0,0 +1,68 @@ |
|||
# -*- 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.report import report_sxw |
|||
from openerp import models |
|||
|
|||
|
|||
class DetailsPosSessionReport(report_sxw.rml_parse): |
|||
|
|||
def _get_qtd_payments(self, line): |
|||
if line.amount < 0: |
|||
return '' |
|||
|
|||
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_account_bank_statement_lines(self): |
|||
pos_session_obj = self.pool.get('pos.session').browse( |
|||
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 |
|||
) |
|||
lines_sorted = sorted( |
|||
statements_lines, |
|||
key=lambda lines_sorted: lines_sorted['qtd_payments'] |
|||
) |
|||
return lines_sorted |
|||
|
|||
def __init__(self, cr, uid, name, context): |
|||
super(DetailsPosSessionReport, self).__init__(cr, uid, name, |
|||
context=context) |
|||
self.localcontext.update({ |
|||
'get_account_bank_statement_lines': |
|||
self._get_account_bank_statement_lines, |
|||
}) |
|||
|
|||
|
|||
class PosSessionReport(models.AbstractModel): |
|||
_name = 'report.pos_session_report.pos_session_report' |
|||
_inherit = 'report.abstract_report' |
|||
_template = 'pos_session_report.pos_session_report' |
|||
_wrapped_report_class = DetailsPosSessionReport |
@ -0,0 +1,184 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<template id="pos_session_report_document"> |
|||
<t t-call="report.html_container"> |
|||
<t t-call="report.internal_layout"> |
|||
<div class="page"> |
|||
<h2>Session Summary: |
|||
<span t-field="o.name"/> |
|||
</h2> |
|||
<div class="row mt32 mb32"> |
|||
<div class="col-xs-3"> |
|||
<strong>Responsible</strong>: |
|||
<br/> |
|||
<span t-field="o.user_id"/> |
|||
</div> |
|||
<div class="col-xs-3"> |
|||
<strong>Point of Sale</strong>: |
|||
<br/> |
|||
<span t-field="o.config_id"/> |
|||
</div> |
|||
<div class="col-xs-3"> |
|||
<strong>Opening Date</strong>: |
|||
<br/> |
|||
<span t-field="o.start_at"/> |
|||
</div> |
|||
<div class="col-xs-3"> |
|||
<strong>Closing Date</strong>: |
|||
<br/> |
|||
<span t-field="o.stop_at"/> |
|||
</div> |
|||
</div> |
|||
<h4>Statement Summary</h4> |
|||
<table class="table table-condensed mb32"> |
|||
<thead> |
|||
<tr> |
|||
<th> |
|||
<strong>Reference</strong> |
|||
</th> |
|||
<th> |
|||
<strong>Journal</strong> |
|||
</th> |
|||
<th class="text-right"> |
|||
<strong>Starting Balance</strong> |
|||
</th> |
|||
<th class="text-right"> |
|||
<strong>Total Transactions</strong> |
|||
</th> |
|||
<th class="text-right"> |
|||
<strong>Ending Balance</strong> |
|||
</th> |
|||
<th class="text-right"> |
|||
<strong>Difference</strong> |
|||
</th> |
|||
<th class="text-right" |
|||
groups="base.group_multi_currency"> |
|||
<strong>Currency</strong> |
|||
</th> |
|||
<th class="text-right"> |
|||
<strong>Status</strong> |
|||
</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="o.statement_ids" |
|||
t-as="statement"> |
|||
<td> |
|||
<span t-field="statement.name"/> |
|||
</td> |
|||
<td> |
|||
<span t-field="statement.journal_id"/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="statement.balance_start" |
|||
t-field-options='{"widget": "monetary", "display_currency": "statement.currency"}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="statement.total_entry_encoding" |
|||
t-field-options='{"widget": "monetary", "display_currency": "statement.currency"}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="statement.balance_end_real" |
|||
t-field-options='{"widget": "monetary", "display_currency": "statement.currency"}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="statement.difference" |
|||
t-field-options='{"widget": "monetary", "display_currency": "statement.currency"}'/> |
|||
</td> |
|||
<td class="text-right" |
|||
groups="base.group_multi_currency"> |
|||
<span t-field="statement.currency" |
|||
t-field-options='{"widget": "monetary", "display_currency": "statement.currency"}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="statement.state"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<t t-foreach="o.statement_ids" t-as="statement"> |
|||
<t t-if="statement.balance_end"> |
|||
<br/> |
|||
<br/> |
|||
<h4>Journal: |
|||
<span t-esc="statement.journal_id.name"/> |
|||
</h4> |
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>Name</th> |
|||
<th>Date</th> |
|||
<th>Pos Order</th> |
|||
<th>State</th> |
|||
<th>QTD Payments</th> |
|||
<th class="text-right">Amount</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<tr t-foreach="get_account_bank_statement_lines()" |
|||
t-as="bank_statement_line"> |
|||
|
|||
<t t-if="bank_statement_line['journal_id'].id==statement.journal_id.id"> |
|||
|
|||
<td> |
|||
<span t-esc="bank_statement_line['name']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="bank_statement_line['date']"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="bank_statement_line['pos_statement_id'].name"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="bank_statement_line['pos_statement_id'].state"/> |
|||
</td> |
|||
<td> |
|||
<span t-esc="bank_statement_line['qtd_payments']"/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-esc="bank_statement_line['amount']"/> |
|||
</td> |
|||
</t> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
<div class="text-right"> |
|||
<tr> |
|||
<th> |
|||
<b>Total:</b> |
|||
</th> |
|||
<th> |
|||
<t t-esc="statement.balance_end"/> |
|||
</th> |
|||
</tr> |
|||
</div> |
|||
<hr/> |
|||
</t> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
<!--translate--> |
|||
<template id="pos_session_report.pos_session_report"> |
|||
<t t-call="report.html_container"> |
|||
<t t-foreach="doc_ids" t-as="doc_id"> |
|||
<t t-raw="translate_doc(doc_id, doc_model, 'user_id.lang', 'pos_session_report.pos_session_report_document')"/> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
<report |
|||
id="action_report_pos_session_report" |
|||
string="Pos Session Summary Detailed" |
|||
model="pos.session" |
|||
report_type="qweb-pdf" |
|||
name="pos_session_report.pos_session_report" |
|||
file="pos_session_report.pos_session_report" |
|||
/> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue