From 5a51aba489ddad245feaa3634a0bd5f166152ce1 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Mon, 9 Oct 2017 12:25:33 +0200 Subject: [PATCH] Migration of pos_session_pay_invoice to 11.0 --- pos_session_pay_invoice/README.rst | 30 +++++++++++++------ pos_session_pay_invoice/__manifest__.py | 5 ++-- .../tests/test_pay_invoice.py | 17 ++++++++++- .../views/account_bank_statement.xml | 21 ------------- .../wizard/cash_invoice_out.xml | 2 +- 5 files changed, 40 insertions(+), 35 deletions(-) delete mode 100644 pos_session_pay_invoice/views/account_bank_statement.xml diff --git a/pos_session_pay_invoice/README.rst b/pos_session_pay_invoice/README.rst index e8585e61..4df01023 100644 --- a/pos_session_pay_invoice/README.rst +++ b/pos_session_pay_invoice/README.rst @@ -1,23 +1,34 @@ .. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg :alt: License: LGPL-3 -======================== -Account cash Pay invoice -======================== +======================= +POS Session Pay invoice +======================= This modules allows to pay an existing Supplier Invoice / Customer Refund, or -to collect payment for an existing Customer Invoice, using bank statements. +to collect payment for an existing Customer Invoice, from within a POS Session. +Installation +============ + +* In order to install this module, you will need to install first the + module 'account_cash_invoice', available in https://github.com/OCA/account-payment/11.0 + +Configuration +============= +#. Go to *Point of Sale / Configuration / Point of Sale* and activate the + 'Cash Control' setting. Usage ===== -#. Go to *Accounting / Dashboard* and create and/or open an existing - bank statement. +#. Go to *Point of Sale / Dashboard* and create and open or access to an + already open POS Session. #. Press the button **Pay Invoice** to pay a Supplier Invoice or a Customer - Refund. You will need to select the expected Journal + Refund. It will be paid using Cash. #. Select **Collect Payment from Invoice** in to receive a payment of an - existing Customer Invoice or a Supplier Refund. + existing Customer Invoice or a Supplier Refund. You will need to select + a Journal if the POS Config has defined multiple Payment Methods. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot @@ -38,6 +49,7 @@ Contributors ------------ * Enric Tobella +* Jordi Ballester Maintainer @@ -53,4 +65,4 @@ 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. +To contribute to this module, please visit https://odoo-community.org. diff --git a/pos_session_pay_invoice/__manifest__.py b/pos_session_pay_invoice/__manifest__.py index 6531bf39..cba714c7 100644 --- a/pos_session_pay_invoice/__manifest__.py +++ b/pos_session_pay_invoice/__manifest__.py @@ -3,8 +3,8 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). { - 'name': 'POS Pay invoice', - 'version': '10.0.1.0.0', + 'name': 'POS Session Pay invoice', + 'version': '11.0.1.0.0', 'category': 'Point Of Sale', 'author': "Creu Blanca," "Odoo Community Association (OCA)", @@ -18,6 +18,5 @@ "wizard/cash_invoice_out.xml", "wizard/cash_invoice_in.xml", "views/pos_session.xml", - "views/account_bank_statement.xml", ], } diff --git a/pos_session_pay_invoice/tests/test_pay_invoice.py b/pos_session_pay_invoice/tests/test_pay_invoice.py index 4cd5a09a..6492b914 100644 --- a/pos_session_pay_invoice/tests/test_pay_invoice.py +++ b/pos_session_pay_invoice/tests/test_pay_invoice.py @@ -54,10 +54,25 @@ class TestSessionPayInvoice(common.TransactionCase): self.config = self.env.ref('point_of_sale.pos_config_main') self.config.cash_control = True + self.account_cash_differences_id = self.env['account.account'].create({ + 'code': 'test_cash_differences', + 'company_id': self.company.id, + 'name': 'Test Cash Differences', + 'user_type_id': self.env.ref( + 'account.data_account_type_revenue').id + }) + def test_pos_invoice(self): self.config.open_session_cb() session = self.config.current_session_id self.assertIsNotNone(session.statement_ids) + cash_statements = session.statement_ids.filtered( + lambda x: x.journal_id.type == 'cash') + self.assertEquals(len(cash_statements), 1) + journal = cash_statements[0].journal_id + journal.profit_account_id = self.account_cash_differences_id + journal.loss_account_id = self.account_cash_differences_id + session.action_pos_session_open() in_invoice = self.env['cash.invoice.in'].with_context( active_ids=session.ids, active_model='pos.session' @@ -81,6 +96,6 @@ class TestSessionPayInvoice(common.TransactionCase): }) box.run() session.action_pos_session_closing_control() - session.action_pos_session_closing_control() + session.action_pos_session_validate() self.assertEqual(self.invoice_out.residual, 25.) self.assertEqual(self.invoice_in.residual, 0.) diff --git a/pos_session_pay_invoice/views/account_bank_statement.xml b/pos_session_pay_invoice/views/account_bank_statement.xml deleted file mode 100644 index 95b1170d..00000000 --- a/pos_session_pay_invoice/views/account_bank_statement.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/pos_session_pay_invoice/wizard/cash_invoice_out.xml b/pos_session_pay_invoice/wizard/cash_invoice_out.xml index 0af983ef..8a84f40f 100644 --- a/pos_session_pay_invoice/wizard/cash_invoice_out.xml +++ b/pos_session_pay_invoice/wizard/cash_invoice_out.xml @@ -2,7 +2,7 @@