diff --git a/pos_session_summary/README.rst b/pos_session_summary/README.rst new file mode 100644 index 00000000..b17fcb28 --- /dev/null +++ b/pos_session_summary/README.rst @@ -0,0 +1,74 @@ +.. 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 + +========================================================= +Point of Sale - Total of transactions and Orders Quantity +========================================================= + +* add a computed field 'Transactions Total' on the PoS Session model, + that is the sum of all transactions of all journals of the session; + +* add a computed field 'Orders Qty' on the PoS Session model, + that is the quantity of all orders of the session; + + +.. image:: /pos_session_summary/static/description/pos_session_list.png + + +Installation +============ + +Normal installation. + +Configuration +============= + +No configuration is needed. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/184/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Contributors +------------ + +* Sylvain LE GAL + +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. diff --git a/pos_session_summary/__init__.py b/pos_session_summary/__init__.py new file mode 100644 index 00000000..a0fdc10f --- /dev/null +++ b/pos_session_summary/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/pos_session_summary/__openerp__.py b/pos_session_summary/__openerp__.py new file mode 100644 index 00000000..27d1c295 --- /dev/null +++ b/pos_session_summary/__openerp__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016-Today: La Louve () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +{ + 'name': 'Point of Sale - Session Summary', + 'version': '9.0.1.0.0', + 'category': 'Point Of Sale', + 'summary': 'Point of Sale - Total of transactions and Orders Quantity', + 'author': 'La Louve, Odoo Community Association (OCA)', + 'website': 'http://www.lalouve.net/', + 'depends': [ + 'point_of_sale', + ], + 'data': [ + 'views/pos_session_view.xml', + ], + 'installable': True, + 'license': 'AGPL-3', +} diff --git a/pos_session_summary/i18n/fr.po b/pos_session_summary/i18n/fr.po new file mode 100644 index 00000000..a92e9b24 --- /dev/null +++ b/pos_session_summary/i18n/fr.po @@ -0,0 +1,66 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_session_summary +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-09-07 14:33+0000\n" +"PO-Revision-Date: 2016-09-07 14:33+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_session_summary +#: model:ir.ui.view,arch_db:pos_session_summary.report_sessionsummary_louve +msgid "Cash Moves" +msgstr "Mouvements d'argent" + +#. module: pos_session_summary +#: model:ir.ui.view,arch_db:pos_session_summary.report_sessionsummary_louve +msgid "Sale Transactions Subtotal" +msgstr "Ss-total des ventes" + +#. module: pos_session_summary +#: model:ir.model,name:pos_session_summary.model_account_bank_statement +msgid "Bank Statement" +msgstr "Relevé bancaire" + +#. module: pos_session_summary +#: model:ir.model.fields,field_description:pos_session_summary.field_account_bank_statement_total_entry_encoding_cash +msgid "Cash Moves" +msgstr "Mouvements d'argent" + +#. module: pos_session_summary +#: model:ir.model.fields,field_description:pos_session_summary.field_pos_session_order_qty +msgid "Orders Qty" +msgstr "Nb. ventes" + +#. module: pos_session_summary +#: model:ir.model.fields,field_description:pos_session_summary.field_account_bank_statement_total_entry_encoding_sales +msgid "Sale Transactions Subtotal" +msgstr "Ss-total des Ventes" + +#. module: pos_session_summary +#: model:ir.model.fields,help:pos_session_summary.field_account_bank_statement_total_entry_encoding_cash +msgid "Total of cash inputs or outputs." +msgstr "Total des entrées ou sorties d'argent." + +#. module: pos_session_summary +#: model:ir.model.fields,help:pos_session_summary.field_account_bank_statement_total_entry_encoding_sales +msgid "Total of sale transaction lines." +msgstr "Total des transactions de vente." + +#. module: pos_session_summary +#: model:ir.model.fields,field_description:pos_session_summary.field_pos_session_total_amount +msgid "Transactions Total" +msgstr "Total des transactions" + +#. module: pos_session_summary +#: model:ir.model,name:pos_session_summary.model_pos_session +msgid "pos.session" +msgstr "pos.session" diff --git a/pos_session_summary/models/__init__.py b/pos_session_summary/models/__init__.py new file mode 100644 index 00000000..05a7876b --- /dev/null +++ b/pos_session_summary/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import pos_session +from . import account_bank_statement diff --git a/pos_session_summary/models/account_bank_statement.py b/pos_session_summary/models/account_bank_statement.py new file mode 100644 index 00000000..221a5a20 --- /dev/null +++ b/pos_session_summary/models/account_bank_statement.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016-Today: La Louve () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# Julien Weste (julien.weste@akretion.com.br) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import fields, models, api + + +class AccountBankStatement(models.Model): + _inherit = 'account.bank.statement' + + total_entry_encoding_sales = fields.Monetary( + 'Sale Transactions Subtotal', compute='_compute_total_entries', + store=True, multi='total_entries', + help="Total of sale transaction lines.") + total_entry_encoding_cash = fields.Monetary( + 'Cash Moves', compute='_compute_total_entries', store=True, + multi='total_entries', help="Total of cash inputs or outputs.") + + @api.multi + @api.depends( + 'line_ids', 'balance_start', 'line_ids.amount', 'balance_end_real') + def _compute_total_entries(self): + for abst in self: + abst.total_entry_encoding_sales = sum( + [line.amount for line in abst.line_ids + if line.pos_statement_id]) + abst.total_entry_encoding_cash = sum( + [line.amount for line in abst.line_ids + if not line.pos_statement_id]) diff --git a/pos_session_summary/models/pos_session.py b/pos_session_summary/models/pos_session.py new file mode 100644 index 00000000..95cceac2 --- /dev/null +++ b/pos_session_summary/models/pos_session.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2016-Today: La Louve () +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from openerp import fields, models, api + + +class PosSession(models.Model): + _inherit = 'pos.session' + + @api.multi + @api.depends('order_ids.lines.price_subtotal_incl') + def _compute_orders(self): + for session in self: + session.order_qty = len(session.order_ids) + session.total_amount = sum( + session.mapped('order_ids.amount_total')) + + total_amount = fields.Monetary( + compute='_compute_orders', string='Transactions Total', multi='orders', + store=True) + + order_qty = fields.Integer( + compute='_compute_orders', string='Orders Qty', multi='orders', + store=True) diff --git a/pos_session_summary/static/description/icon.png b/pos_session_summary/static/description/icon.png new file mode 100644 index 00000000..8a63392a Binary files /dev/null and b/pos_session_summary/static/description/icon.png differ diff --git a/pos_session_summary/static/description/pos_session_list.png b/pos_session_summary/static/description/pos_session_list.png new file mode 100644 index 00000000..bb24f4e4 Binary files /dev/null and b/pos_session_summary/static/description/pos_session_list.png differ diff --git a/pos_session_summary/views/pos_session_view.xml b/pos_session_summary/views/pos_session_view.xml new file mode 100644 index 00000000..3a747d21 --- /dev/null +++ b/pos_session_summary/views/pos_session_view.xml @@ -0,0 +1,37 @@ + + + + + + + pos.session + + + + + + + + + + + pos.session + + + + + + + + + + + + + + +