Browse Source
Merge pull request #77 from legalsylvain/9.0_pos_total_session
Merge pull request #77 from legalsylvain/9.0_pos_total_session
[ADD] new module 'pos_session_summary';pull/132/head
Sylvain LE GAL
8 years ago
committed by
GitHub
10 changed files with 260 additions and 0 deletions
-
74pos_session_summary/README.rst
-
2pos_session_summary/__init__.py
-
21pos_session_summary/__openerp__.py
-
66pos_session_summary/i18n/fr.po
-
3pos_session_summary/models/__init__.py
-
31pos_session_summary/models/account_bank_statement.py
-
26pos_session_summary/models/pos_session.py
-
BINpos_session_summary/static/description/icon.png
-
BINpos_session_summary/static/description/pos_session_list.png
-
37pos_session_summary/views/pos_session_view.xml
@ -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 |
|||
<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 |
|||
<https://github.com/OCA/ |
|||
pos/issues/new?body=module:%20 |
|||
pos_session_summary%0Aversion:%20 |
|||
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. |
|||
|
|||
Credits |
|||
======= |
|||
|
|||
Images |
|||
------ |
|||
|
|||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|||
|
|||
Contributors |
|||
------------ |
|||
|
|||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
|||
|
|||
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,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import models |
@ -0,0 +1,21 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @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', |
|||
} |
@ -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 "<strong>Cash Moves</strong>" |
|||
msgstr "<strong>Mouvements d'argent</strong>" |
|||
|
|||
#. module: pos_session_summary |
|||
#: model:ir.ui.view,arch_db:pos_session_summary.report_sessionsummary_louve |
|||
msgid "<strong>Sale Transactions Subtotal</strong>" |
|||
msgstr "<strong>Ss-total des ventes</strong>" |
|||
|
|||
#. 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" |
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import pos_session |
|||
from . import account_bank_statement |
@ -0,0 +1,31 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @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]) |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
# @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) |
After Width: 64 | Height: 64 | Size: 4.4 KiB |
After Width: 827 | Height: 132 | Size: 19 KiB |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0"?> |
|||
<!-- |
|||
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>) |
|||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) |
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record model="ir.ui.view" id="view_pos_session_tree"> |
|||
<field name="model">pos.session</field> |
|||
<field name="inherit_id" ref="point_of_sale.view_pos_session_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="stop_at" position="after"> |
|||
<field name="order_qty" /> |
|||
<field name="total_amount" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record model="ir.ui.view" id="view_pos_session_form"> |
|||
<field name="model">pos.session</field> |
|||
<field name="inherit_id" ref="point_of_sale.view_pos_session_form"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="config_id" position="after"> |
|||
<field name="order_qty" /> |
|||
<field name="total_amount" /> |
|||
</field> |
|||
<field name="total_entry_encoding" position="replace"> |
|||
<field name="total_entry_encoding_sales" /> |
|||
<field name="total_entry_encoding_cash" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue