Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] pos_custom_report_session #262

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pos_custom_report_session/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions pos_custom_report_session/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Chafique Delli <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "POS Custom Report Session",
"version": "14.0.1.0.0",
"category": "Point Of Sale",
"author": "Akretion",
"website": "https://github.com/akretion/ak-odoo-incubator",
"license": "AGPL-3",
"depends": [
"pos_report_session_summary",
"pos_sale_order",
],
"data": [
"views/report_session_summary.xml",
],
"qweb": [],
"installable": True,
}
2 changes: 2 additions & 0 deletions pos_custom_report_session/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_statement_line
from . import pos_payment
13 changes: 13 additions & 0 deletions pos_custom_report_session/models/account_statement_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Chafique Delli <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class AccountBankStatementLine(models.Model):
_inherit = "account.bank.statement.line"

pos_payment_ids = fields.One2many(
"pos.payment", "statement_line_id", "Pos Payments"
)
11 changes: 11 additions & 0 deletions pos_custom_report_session/models/pos_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2023 Akretion (https://www.akretion.com).
# @author Chafique Delli <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class PosPayment(models.Model):
_inherit = "pos.payment"

statement_line_id = fields.Many2one("account.bank.statement.line", "Statement Line")
55 changes: 55 additions & 0 deletions pos_custom_report_session/views/report_session_summary.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_session_summary"
inherit_id="pos_report_session_summary.report_session_summary"
>
<xpath expr="//div/t/table" position="replace">
<table class="table table-sm o_main_table" t-if="statement.line_ids">
<thead>
<tr>
<th>Date</th>
<th>Description</th>
<th>Reference</th>
<th>Partner</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<t t-foreach="statement.line_ids" t-as="line">
<t t-if="line.pos_payment_ids">
<tr t-foreach="line.pos_payment_ids" t-as="payment">

<td><span t-field="payment.payment_date" /></td>
<td><span t-field="line.name" /></td>
<td>
<span t-field="payment.name" />
<span t-field="payment.pos_sale_order_id.name" />
</td>
<td><span t-field="payment.partner_id" /></td>
<td class="text-right">
<span
t-field="payment.amount"
t-field-options='{"widget": "monetary", "display_currency": "statement.currency_id"}'
/>
</td>
</tr>
</t>
<tr t-else="">
<td><span t-field="line.date" /></td>
<td><span t-field="line.name" /></td>
<td><span t-field="line.payment_ref" /></td>
<td><span t-field="line.partner_id" /></td>
<td class="text-right">
<span
t-field="line.amount"
t-field-options='{"widget": "monetary", "display_currency": "statement.currency_id"}'
/>
</td>
</tr>
</t>
</tbody>
</table>
</xpath>
</template>
</odoo>
6 changes: 6 additions & 0 deletions setup/pos_custom_report_session/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)