OCA-git-bot
4 years ago
13 changed files with 669 additions and 0 deletions
-
1pos_report_order_payment/__init__.py
-
21pos_report_order_payment/__manifest__.py
-
192pos_report_order_payment/i18n/fr.po
-
192pos_report_order_payment/i18n/pos_report_order_payment.pot
-
5pos_report_order_payment/readme/CONTRIBUTORS.rst
-
5pos_report_order_payment/readme/DESCRIPTION.rst
-
1pos_report_order_payment/readme/USAGE.rst
-
1pos_report_order_payment/report/__init__.py
-
182pos_report_order_payment/report/pos_order_payment_report.py
-
67pos_report_order_payment/report/pos_order_payment_report.xml
-
2pos_report_order_payment/security/ir.model.access.csv
-
BINpos_report_order_payment/static/description/graph.png
-
BINpos_report_order_payment/static/description/pivot.png
@ -0,0 +1 @@ |
|||
from . import report |
@ -0,0 +1,21 @@ |
|||
# Copyright 2020 Iván Todorovich <ivan.todorovich@gmail.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
{ |
|||
'name': 'Point of Sale Payment Report', |
|||
'summary': 'Analyze point of sale payments', |
|||
'category': 'Point of Sale', |
|||
'version': '12.0.1.0.0', |
|||
'author': 'Druidoo, ' |
|||
'Moka Tourisme, ' |
|||
'Odoo Community Association (OCA)', |
|||
'license': 'AGPL-3', |
|||
'website': 'https://github.com/OCA/pos', |
|||
'depends': [ |
|||
'point_of_sale', |
|||
], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'report/pos_order_payment_report.xml', |
|||
], |
|||
} |
@ -0,0 +1,192 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_report_order_payment |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2020-09-04 15:28+0000\n" |
|||
"PO-Revision-Date: 2020-09-04 15:28+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_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Cancelled" |
|||
msgstr "Annulé" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__company_id |
|||
msgid "Company" |
|||
msgstr "Société" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__partner_id |
|||
msgid "Customer" |
|||
msgstr "Client" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__display_name |
|||
msgid "Display Name" |
|||
msgstr "Nom affiché" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Group By" |
|||
msgstr "Regrouper par" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__id |
|||
msgid "ID" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__invoiced |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Invoiced" |
|||
msgstr "Facturé" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__journal_id |
|||
msgid "Journal" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment____last_update |
|||
msgid "Last Modified on" |
|||
msgstr "Dernière modification le" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__location_id |
|||
msgid "Location" |
|||
msgstr "Lieu" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "My Sales" |
|||
msgstr "Mes ventes" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "New" |
|||
msgstr "Nouveau" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Not Invoiced" |
|||
msgstr "Non facturée" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__order_id |
|||
msgid "Order" |
|||
msgstr "Commande" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__date |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Order Date" |
|||
msgstr "Date de la commande" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.ui.menu,name:pos_report_order_payment.menu_report_pos_order_payment |
|||
msgid "Order Payments" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.actions.act_window,name:pos_report_order_payment.action_report_pos_order_payment |
|||
msgid "Order Payments Analysis" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Paid" |
|||
msgstr "Payé" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__payment_amount |
|||
msgid "Payment Amount" |
|||
msgstr "Montant du paiement" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__payment_journal_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Payment Journal" |
|||
msgstr "Journal des Paiements" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__pos_categ_id |
|||
msgid "PoS Category" |
|||
msgstr "Catégorie du PdV" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__config_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Point of Sale" |
|||
msgstr "Point de vente" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model,name:pos_report_order_payment.model_report_pos_order_payment |
|||
msgid "Point of Sale Order Payments Report" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model,name:pos_report_order_payment.model_report_pos_order |
|||
msgid "Point of Sale Orders Report" |
|||
msgstr "Rapport sur les commandes au point de vente" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_graph |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_pivot |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Point of Sale Payment Analysis" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Posted" |
|||
msgstr "Comptabilisé" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__pricelist_id |
|||
msgid "Pricelist" |
|||
msgstr "Liste de prix" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Product" |
|||
msgstr "Article" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_categ_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Product Category" |
|||
msgstr "Catégorie d'article" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_tmpl_id |
|||
msgid "Product Template" |
|||
msgstr "Modèle d'article" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__user_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Salesperson" |
|||
msgstr "Vendeur" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__session_id |
|||
msgid "Session" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__state |
|||
msgid "Status" |
|||
msgstr "Statut" |
|||
|
@ -0,0 +1,192 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * pos_report_order_payment |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2020-09-04 15:27+0000\n" |
|||
"PO-Revision-Date: 2020-09-04 15:27+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_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Cancelled" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__company_id |
|||
msgid "Company" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__partner_id |
|||
msgid "Customer" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__display_name |
|||
msgid "Display Name" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Group By" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__id |
|||
msgid "ID" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__invoiced |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Invoiced" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__journal_id |
|||
msgid "Journal" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment____last_update |
|||
msgid "Last Modified on" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__location_id |
|||
msgid "Location" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "My Sales" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "New" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Not Invoiced" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__order_id |
|||
msgid "Order" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__date |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Order Date" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.ui.menu,name:pos_report_order_payment.menu_report_pos_order_payment |
|||
msgid "Order Payments" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.actions.act_window,name:pos_report_order_payment.action_report_pos_order_payment |
|||
msgid "Order Payments Analysis" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Paid" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__payment_amount |
|||
msgid "Payment Amount" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__payment_journal_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Payment Journal" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__pos_categ_id |
|||
msgid "PoS Category" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__config_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Point of Sale" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model,name:pos_report_order_payment.model_report_pos_order_payment |
|||
msgid "Point of Sale Order Payments Report" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model,name:pos_report_order_payment.model_report_pos_order |
|||
msgid "Point of Sale Orders Report" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_graph |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_pivot |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Point of Sale Payment Analysis" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: selection:report.pos.order.payment,state:0 |
|||
msgid "Posted" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__pricelist_id |
|||
msgid "Pricelist" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Product" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_categ_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Product Category" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__product_tmpl_id |
|||
msgid "Product Template" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__user_id |
|||
#: model_terms:ir.ui.view,arch_db:pos_report_order_payment.view_report_pos_order_payment_search |
|||
msgid "Salesperson" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__session_id |
|||
msgid "Session" |
|||
msgstr "" |
|||
|
|||
#. module: pos_report_order_payment |
|||
#: model:ir.model.fields,field_description:pos_report_order_payment.field_report_pos_order_payment__state |
|||
msgid "Status" |
|||
msgstr "" |
|||
|
@ -0,0 +1,5 @@ |
|||
* `Druidoo <https://www.druidoo.io>`_: |
|||
* Iván Todorovich <ivan.todorovich@gmail.com> |
|||
|
|||
* `Moka Tourisme <https://www.mokatourisme.fr>`_: |
|||
* Grégory Schreiner |
@ -0,0 +1,5 @@ |
|||
Adds views to analyze point of sale payments |
|||
|
|||
.. figure:: ../static/description/graph.png |
|||
|
|||
.. figure:: ../static/description/pivot.png |
@ -0,0 +1 @@ |
|||
Go to Point of Sale > Analysis > Order Payments |
@ -0,0 +1 @@ |
|||
from . import pos_order_payment_report |
@ -0,0 +1,182 @@ |
|||
# Copyright 2020 Iván Todorovich <ivan.todorovich@gmail.com> |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, models, fields, tools |
|||
|
|||
|
|||
class PosOrderPaymentReport(models.Model): |
|||
_name = 'report.pos.order.payment' |
|||
_description = "Point of Sale Order Payments Report" |
|||
_auto = False |
|||
_order = 'date desc' |
|||
|
|||
date = fields.Datetime( |
|||
string='Order Date', |
|||
readonly=True, |
|||
) |
|||
state = fields.Selection( |
|||
[ |
|||
('draft', 'New'), |
|||
('paid', 'Paid'), |
|||
('done', 'Posted'), |
|||
('invoiced', 'Invoiced'), |
|||
('cancel', 'Cancelled'), |
|||
], |
|||
string='Status', |
|||
readonly=True, |
|||
) |
|||
order_id = fields.Many2one( |
|||
'pos.order', |
|||
string='Order', |
|||
readonly=True, |
|||
) |
|||
session_id = fields.Many2one( |
|||
'pos.session', |
|||
string='Session', |
|||
readonly=True, |
|||
) |
|||
partner_id = fields.Many2one( |
|||
'res.partner', |
|||
string='Customer', |
|||
readonly=True, |
|||
) |
|||
pricelist_id = fields.Many2one( |
|||
'product.pricelist', |
|||
string='Pricelist', |
|||
readonly=True, |
|||
) |
|||
user_id = fields.Many2one( |
|||
'res.users', |
|||
string='Salesperson', |
|||
readonly=True, |
|||
) |
|||
location_id = fields.Many2one( |
|||
'stock.location', |
|||
string='Location', |
|||
readonly=True, |
|||
) |
|||
company_id = fields.Many2one( |
|||
'res.company', |
|||
string='Company', |
|||
readonly=True, |
|||
) |
|||
journal_id = fields.Many2one( |
|||
'account.journal', |
|||
string='Journal', |
|||
readonly=True, |
|||
) |
|||
config_id = fields.Many2one( |
|||
'pos.config', |
|||
string='Point of Sale', |
|||
readonly=True, |
|||
) |
|||
pos_categ_id = fields.Many2one( |
|||
'pos.category', |
|||
string='PoS Category', |
|||
readonly=True, |
|||
) |
|||
product_id = fields.Many2one( |
|||
'product.product', |
|||
string='Product', |
|||
readonly=True, |
|||
) |
|||
product_tmpl_id = fields.Many2one( |
|||
'product.template', |
|||
string='Product Template', |
|||
readonly=True, |
|||
) |
|||
product_categ_id = fields.Many2one( |
|||
'product.category', |
|||
string='Product Category', |
|||
readonly=True, |
|||
) |
|||
payment_journal_id = fields.Many2one( |
|||
"account.journal", |
|||
string="Payment Journal", |
|||
readonly=True, |
|||
) |
|||
payment_amount = fields.Float( |
|||
string="Paid Amount", |
|||
readonly=True, |
|||
) |
|||
invoiced = fields.Boolean( |
|||
readonly=True, |
|||
) |
|||
|
|||
def _select(self): |
|||
return """ |
|||
SELECT |
|||
ROW_NUMBER() OVER() AS id, |
|||
s.date_order AS date, |
|||
s.id as order_id, |
|||
s.partner_id AS partner_id, |
|||
s.state AS state, |
|||
s.user_id AS user_id, |
|||
s.location_id AS location_id, |
|||
s.company_id AS company_id, |
|||
s.sale_journal AS journal_id, |
|||
l.product_id AS product_id, |
|||
pt.categ_id AS product_categ_id, |
|||
p.product_tmpl_id, |
|||
ps.config_id, |
|||
pt.pos_categ_id, |
|||
s.pricelist_id, |
|||
s.session_id, |
|||
s.invoice_id IS NOT NULL AS invoiced, |
|||
st.journal_id AS payment_journal_id, |
|||
st.amount AS payment_amount |
|||
""" |
|||
|
|||
def _from(self): |
|||
return """ |
|||
FROM pos_order_line AS l |
|||
LEFT JOIN pos_order s ON (s.id = l.order_id) |
|||
LEFT JOIN product_product p ON (l.product_id = p.id) |
|||
LEFT JOIN product_template pt ON (p.product_tmpl_id = pt.id) |
|||
LEFT JOIN uom_uom u ON (u.id = pt.uom_id) |
|||
LEFT JOIN pos_session ps ON (s.session_id = ps.id) |
|||
INNER JOIN (%s) st ON (st.pos_line_id = l.id) |
|||
""" % (self._payment_query()) |
|||
|
|||
def _payment_query(self): |
|||
""" |
|||
Returns a query that distributes the pos.order payments |
|||
among the pos.order.lines |
|||
""" |
|||
return """ |
|||
SELECT |
|||
pol.id AS pos_line_id, |
|||
sl.id AS statement_line_id, |
|||
st.journal_id AS journal_id, |
|||
( |
|||
sl.amount / po.amount_total * pol.price_subtotal_incl |
|||
) AS amount |
|||
FROM pos_order_line AS pol |
|||
INNER JOIN pos_order AS po |
|||
ON pol.order_id = po.id |
|||
INNER JOIN account_bank_statement_line AS sl |
|||
ON pol.order_id = sl.pos_statement_id |
|||
INNER JOIN account_bank_statement AS st |
|||
ON st.id = sl.statement_id |
|||
""" |
|||
|
|||
def _group_by(self): |
|||
return "" |
|||
|
|||
def _having(self): |
|||
return "" |
|||
|
|||
@api.model_cr |
|||
def init(self): |
|||
tools.drop_view_if_exists(self._cr, self._table) |
|||
self._cr.execute(""" |
|||
CREATE OR REPLACE VIEW %s AS ( |
|||
%s |
|||
%s |
|||
%s |
|||
%s |
|||
) |
|||
""" % ( |
|||
self._table, |
|||
self._select(), self._from(), self._group_by(), self._having(), |
|||
)) |
@ -0,0 +1,67 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="view_report_pos_order_payment_pivot" model="ir.ui.view"> |
|||
<field name="model">report.pos.order.payment</field> |
|||
<field name="arch" type="xml"> |
|||
<pivot string="Point of Sale Payment Analysis" disable_linking="True"> |
|||
<field name="config_id" type="row"/> |
|||
<field name="payment_journal_id" type="col"/> |
|||
<field name="payment_amount" type="measure"/> |
|||
</pivot> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_report_pos_order_payment_graph" model="ir.ui.view"> |
|||
<field name="model">report.pos.order.payment</field> |
|||
<field name="arch" type="xml"> |
|||
<graph string="Point of Sale Payment Analysis"> |
|||
<field name="payment_journal_id" type="row"/> |
|||
<field name="payment_amount" type="measure"/> |
|||
</graph> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_report_pos_order_payment_search" model="ir.ui.view"> |
|||
<field name="model">report.pos.order.payment</field> |
|||
<field name="arch" type="xml"> |
|||
<search string="Point of Sale Payment Analysis"> |
|||
<field name="date"/> |
|||
<filter string="My Sales" name="my_sales" help="My Sales" domain="[('user_id', '=', uid)]"/> |
|||
<separator/> |
|||
<filter string="Invoiced" name="invoiced" domain="[('state', '=', 'invoiced')]"/> |
|||
<filter string="Not Invoiced" name="not_invoiced" domain="[('state', '=', 'paid')]"/> |
|||
<field name="config_id"/> |
|||
<field name="partner_id"/> |
|||
<field name="user_id"/> |
|||
<field name="product_id"/> |
|||
<field name="product_categ_id"/> |
|||
<group expand="1" string="Group By"> |
|||
<filter string="Salesperson" name="User" context="{'group_by': 'user_id'}"/> |
|||
<filter string="Point of Sale" name="pos" context="{'group_by': 'config_id'}"/> |
|||
<filter string="Product" name="product" context="{'group_by': 'product_id'}"/> |
|||
<filter string="Product Category" name="product_category" context="{'group_by': 'product_categ_id'}"/> |
|||
<filter string="Payment Journal" name="payment_journal" context="{'group_by': 'payment_journal_id'}"/> |
|||
<separator/> |
|||
<filter string="Order Date" name="order_month" context="{'group_by': 'date:month'}"/> |
|||
</group> |
|||
</search> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="action_report_pos_order_payment" model="ir.actions.act_window"> |
|||
<field name="name">Order Payments Analysis</field> |
|||
<field name="res_model">report.pos.order.payment</field> |
|||
<field name="view_type">form</field> |
|||
<field name="view_mode">graph,pivot</field> |
|||
<field name="context">{'group_by_no_leaf': 1, 'group_by': []}</field> |
|||
</record> |
|||
|
|||
<menuitem |
|||
id="menu_report_pos_order_payment" |
|||
name="Order Payments" |
|||
action="action_report_pos_order_payment" |
|||
parent="point_of_sale.menu_point_rep" |
|||
sequence="3"/> |
|||
|
|||
</odoo> |
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_report_pos_order_payment,report.pos.order.payment,model_report_pos_order_payment,point_of_sale.group_pos_user,1,1,1,1 |
After Width: 1920 | Height: 947 | Size: 34 KiB |
After Width: 721 | Height: 608 | Size: 84 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue