diff --git a/pos_transfer_account/README.rst b/pos_transfer_account/README.rst new file mode 100644 index 00000000..8395abf0 --- /dev/null +++ b/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 +`_. 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_transfer_account/__init__.py b/pos_transfer_account/__init__.py new file mode 100644 index 00000000..a0fdc10f --- /dev/null +++ b/pos_transfer_account/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/pos_transfer_account/__openerp__.py b/pos_transfer_account/__openerp__.py new file mode 100644 index 00000000..dfbeb95f --- /dev/null +++ b/pos_transfer_account/__openerp__.py @@ -0,0 +1,23 @@ +# -*- 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 - 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, +} diff --git a/pos_transfer_account/demo/account_account.xml b/pos_transfer_account/demo/account_account.xml new file mode 100644 index 00000000..293de0d4 --- /dev/null +++ b/pos_transfer_account/demo/account_account.xml @@ -0,0 +1,11 @@ + + + + + Demo PoS Liquidity Transfers + 101710 + + + + + diff --git a/pos_transfer_account/demo/pos_config.xml b/pos_transfer_account/demo/pos_config.xml new file mode 100644 index 00000000..edfefa2b --- /dev/null +++ b/pos_transfer_account/demo/pos_config.xml @@ -0,0 +1,13 @@ + + + + + Point Of Sale with Specific Transfer Account + + + + + + + + diff --git a/pos_transfer_account/i18n/fr.po b/pos_transfer_account/i18n/fr.po new file mode 100644 index 00000000..78b047b1 --- /dev/null +++ b/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" + diff --git a/pos_transfer_account/i18n/pos_transfer_account.pot b/pos_transfer_account/i18n/pos_transfer_account.pot new file mode 100644 index 00000000..cb503944 --- /dev/null +++ b/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 "" + diff --git a/pos_transfer_account/models/__init__.py b/pos_transfer_account/models/__init__.py new file mode 100644 index 00000000..2d604a63 --- /dev/null +++ b/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 diff --git a/pos_transfer_account/models/cash_box_in.py b/pos_transfer_account/models/cash_box_in.py new file mode 100644 index 00000000..8a20db33 --- /dev/null +++ b/pos_transfer_account/models/cash_box_in.py @@ -0,0 +1,31 @@ +# -*- 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 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 diff --git a/pos_transfer_account/models/cash_box_out.py b/pos_transfer_account/models/cash_box_out.py new file mode 100644 index 00000000..47ccea4d --- /dev/null +++ b/pos_transfer_account/models/cash_box_out.py @@ -0,0 +1,31 @@ +# -*- 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 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 diff --git a/pos_transfer_account/models/pos_config.py b/pos_transfer_account/models/pos_config.py new file mode 100644 index 00000000..b6aac3b5 --- /dev/null +++ b/pos_transfer_account/models/pos_config.py @@ -0,0 +1,14 @@ +# -*- 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 + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + transfer_account_id = fields.Many2one( + comodel_name='account.account', string='Transfer Account') diff --git a/pos_transfer_account/static/description/icon.png b/pos_transfer_account/static/description/icon.png new file mode 100644 index 00000000..769e9982 Binary files /dev/null and b/pos_transfer_account/static/description/icon.png differ diff --git a/pos_transfer_account/static/description/pos_config.png b/pos_transfer_account/static/description/pos_config.png new file mode 100644 index 00000000..efdf167b Binary files /dev/null and b/pos_transfer_account/static/description/pos_config.png differ diff --git a/pos_transfer_account/views/view_pos_config.xml b/pos_transfer_account/views/view_pos_config.xml new file mode 100644 index 00000000..59ebf05f --- /dev/null +++ b/pos_transfer_account/views/view_pos_config.xml @@ -0,0 +1,20 @@ + + + + + + + pos.config + + + + + + + + +