Browse Source

[ADD] New module pos_transfer_account;

pull/330/head
Sylvain LE GAL 8 years ago
parent
commit
0da4e8205d
  1. 79
      pos_transfer_account/README.rst
  2. 2
      pos_transfer_account/__init__.py
  3. 23
      pos_transfer_account/__openerp__.py
  4. 11
      pos_transfer_account/demo/account_account.xml
  5. 13
      pos_transfer_account/demo/pos_config.xml
  6. 37
      pos_transfer_account/i18n/fr.po
  7. 37
      pos_transfer_account/i18n/pos_transfer_account.pot
  8. 4
      pos_transfer_account/models/__init__.py
  9. 31
      pos_transfer_account/models/cash_box_in.py
  10. 31
      pos_transfer_account/models/cash_box_out.py
  11. 14
      pos_transfer_account/models/pos_config.py
  12. BIN
      pos_transfer_account/static/description/icon.png
  13. BIN
      pos_transfer_account/static/description/pos_config.png
  14. 20
      pos_transfer_account/views/view_pos_config.xml

79
pos_transfer_account/README.rst

@ -0,0 +1,79 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
PoS - Custom Transfer Account
=============================
This module was written to extend the functionality of odoo Point Of Sale about
transfer account.
This module is usefull only in a multi Point of Sale context of multi company
context.
With this module, it is now allowed to define for each PoS config a transfer
account.
If this account is set, it will be used when user realizes "Put Money In" or
"Take Money Out" operation, instead of the default one set in 'Invoicing' /
'Configuration' / 'Setting' Section. ("Inter-Banks Transfer Account" field)
Note
====
You could be interested by another OCA module 'pos_cash_move_reason'.
Installation
============
Normal installation.
Configuration
=============
* Go to 'Point of Sale' / 'Configuration' / 'Point of Sale'
* Edit your PoS Config and add a custom account
.. image:: /pos_transfer_account/static/description/pos_config.png
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.
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.

2
pos_transfer_account/__init__.py

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

23
pos_transfer_account/__openerp__.py

@ -0,0 +1,23 @@
# -*- 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 - Transfer Account',
'version': '9.0.1.0.0',
'category': 'Point Of Sale',
'author': 'La Louve, Odoo Community Association (OCA)',
'website': 'http://www.lalouve.net',
'depends': [
'point_of_sale',
],
'data': [
'views/view_pos_config.xml',
],
'demo': [
'demo/account_account.xml',
'demo/pos_config.xml',
],
'installable': True,
}

11
pos_transfer_account/demo/account_account.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_pos_transfer_account" model="account.account">
<field name="name">Demo PoS Liquidity Transfers</field>
<field name="code">101710</field>
<field name="user_type_id" ref="account.data_account_type_current_assets" />
<field name="company_id" ref="base.main_company" />
</record>
</odoo>

13
pos_transfer_account/demo/pos_config.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="pos_config_specific_transfer_account" model="pos.config">
<field name="name">Point Of Sale with Specific Transfer Account</field>
<field name="transfer_account_id" ref="account_pos_transfer_account" />
<field name="company_id" ref="base.main_company" />
<field name="stock_location_id" ref="stock.stock_location_stock" />
<field name="pricelist_id" ref="product.list0" />
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature" />
</record>
</odoo>

37
pos_transfer_account/i18n/fr.po

@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_transfer_account
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-16 13:34+0000\n"
"PO-Revision-Date: 2016-05-16 13:34+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_transfer_account
#: model:ir.model.fields,field_description:pos_transfer_account.field_pos_config_transfer_account_id
msgid "Transfer Account"
msgstr "Compte de transferts"
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_cash_box_in
msgid "cash.box.in"
msgstr "cash.box.in"
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_cash_box_out
msgid "cash.box.out"
msgstr "cash.box.out"
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_pos_config
msgid "pos.config"
msgstr "pos.config"

37
pos_transfer_account/i18n/pos_transfer_account.pot

@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_transfer_account
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-16 13:35+0000\n"
"PO-Revision-Date: 2016-05-16 13:35+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_transfer_account
#: model:ir.model.fields,field_description:pos_transfer_account.field_pos_config_transfer_account_id
msgid "Transfer Account"
msgstr ""
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_cash_box_in
msgid "cash.box.in"
msgstr ""
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_cash_box_out
msgid "cash.box.out"
msgstr ""
#. module: pos_transfer_account
#: model:ir.model,name:pos_transfer_account.model_pos_config
msgid "pos.config"
msgstr ""

4
pos_transfer_account/models/__init__.py

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import pos_config
from . import cash_box_in
from . import cash_box_out

31
pos_transfer_account/models/cash_box_in.py

@ -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)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api
from openerp.addons.account.wizard.pos_box import CashBox
class CashBoxIn(CashBox):
_inherit = 'cash.box.in'
@api.one
def _calculate_values_for_statement_line(self, record):
session_obj = self.env['pos.session']
active_model = self._context.get('active_model', False)
active_ids = self._context.get('active_ids', [])
# Call with [0] because new api.one func calls old api func
res = super(CashBoxIn, self)._calculate_values_for_statement_line(
record)[0]
if active_model == 'pos.session':
session = session_obj.browse(active_ids[0])
if session.config_id.transfer_account_id:
res['account_id'] =\
session.config_id.transfer_account_id.id
return res

31
pos_transfer_account/models/cash_box_out.py

@ -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)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import api
from openerp.addons.account.wizard.pos_box import CashBox
class CashBoxOut(CashBox):
_inherit = 'cash.box.out'
@api.one
def _calculate_values_for_statement_line(self, record):
session_obj = self.env['pos.session']
active_model = self._context.get('active_model', False)
active_ids = self._context.get('active_ids', [])
# Call with [0] because new api.one func calls old api func
res = super(CashBoxOut, self)._calculate_values_for_statement_line(
record)[0]
if active_model == 'pos.session':
session = session_obj.browse(active_ids[0])
if session.config_id.transfer_account_id:
res['account_id'] =\
session.config_id.transfer_account_id.id
return res

14
pos_transfer_account/models/pos_config.py

@ -0,0 +1,14 @@
# -*- 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
class PosConfig(models.Model):
_inherit = 'pos.config'
transfer_account_id = fields.Many2one(
comodel_name='account.account', string='Transfer Account')

BIN
pos_transfer_account/static/description/icon.png

After

Width: 96  |  Height: 96  |  Size: 4.6 KiB

BIN
pos_transfer_account/static/description/pos_config.png

After

Width: 721  |  Height: 142  |  Size: 24 KiB

20
pos_transfer_account/views/view_pos_config.xml

@ -0,0 +1,20 @@
<?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 id="view_pos_config_form" model="ir.ui.view">
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
<field name="arch" type="xml">
<field name="group_by" position="after">
<field name="transfer_account_id" />
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save