Skip to content

Commit

Permalink
[14.0][ADD] pos_custom_report_session
Browse files Browse the repository at this point in the history
  • Loading branch information
chafique-delli committed Mar 21, 2023
1 parent 0fe6c8e commit 78b3d69
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 0 deletions.
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"
)
13 changes: 13 additions & 0 deletions pos_custom_report_session/models/pos_payment.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"
)
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,
)

0 comments on commit 78b3d69

Please sign in to comment.