Browse Source

[ADD] new module 'pos_session_summary';

pull/77/head
Sylvain LE GAL 9 years ago
parent
commit
9517f21aa6
  1. 58
      pos_session_summary/README.rst
  2. 2
      pos_session_summary/__init__.py
  3. 37
      pos_session_summary/__openerp__.py
  4. 26
      pos_session_summary/i18n/fr.po
  5. 2
      pos_session_summary/models/__init__.py
  6. 37
      pos_session_summary/models/pos_session.py
  7. BIN
      pos_session_summary/static/description/icon.png
  8. BIN
      pos_session_summary/static/description/pos_session_list.png
  9. 35
      pos_session_summary/views/pos_session_view.xml

58
pos_session_summary/README.rst

@ -0,0 +1,58 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
: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_total/static/description/pos_session_tree.png
Configuration
=============
No configuration is needed.
Usage
=====
For further information, please visit:
* https://www.odoo.com/forum/help-1
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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
`here <https://github.com/OCA/{project_repo}/issues/new?body=module:%20pos_session_summary%0Aversion:%209.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
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 http://odoo-community.org.

2
pos_session_summary/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

37
pos_session_summary/__openerp__.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016-Today La Louve (<http://www.lalouve.net/>)
#
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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,
}

26
pos_session_summary/i18n/fr.po

@ -0,0 +1,26 @@
# 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-01-31 16:30+0000\n"
"PO-Revision-Date: 2016-01-31 16:30+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.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_pos_session_total_amount
msgid "Transactions Total"
msgstr "Total des transactions"

2
pos_session_summary/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import pos_session

37
pos_session_summary/models/pos_session.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016-Today La Louve (<http://www.lalouve.net/>)
#
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# The licence is in the file __openerp__.py
#
##############################################################################
from openerp import fields, models, api
class PosSession(models.Model):
_inherit = 'pos.session'
@api.multi
@api.depends('statement_ids.balance_end')
def _compute_total_amount(self):
for session in self:
total_amount = 0
for statement in session.statement_ids:
total_amount += statement.balance_end
session.total_amount = total_amount
@api.multi
@api.depends('order_ids')
def _compute_order_qty(self):
for session in self:
session.order_qty = len(session.order_ids)
total_amount = fields.Monetary(
compute='_compute_total_amount', string='Transactions Total')
order_qty = fields.Integer(
compute='_compute_order_qty', string='Orders Qty')

BIN
pos_session_summary/static/description/icon.png

After

Width: 64  |  Height: 64  |  Size: 4.4 KiB

BIN
pos_session_summary/static/description/pos_session_list.png

After

Width: 1114  |  Height: 137  |  Size: 20 KiB

35
pos_session_summary/views/pos_session_view.xml

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
The licence is in the file __openerp__.py
-->
<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>
</record>
</odoo>
Loading…
Cancel
Save