Browse Source

Migration of pos_session_pay_invoice to 11.0

pull/363/head
Jordi Ballester 7 years ago
committed by Jaime Arroyo
parent
commit
5a51aba489
  1. 30
      pos_session_pay_invoice/README.rst
  2. 5
      pos_session_pay_invoice/__manifest__.py
  3. 17
      pos_session_pay_invoice/tests/test_pay_invoice.py
  4. 21
      pos_session_pay_invoice/views/account_bank_statement.xml
  5. 2
      pos_session_pay_invoice/wizard/cash_invoice_out.xml

30
pos_session_pay_invoice/README.rst

@ -1,23 +1,34 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg .. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg
:alt: License: LGPL-3 :alt: License: LGPL-3
========================
Account cash Pay invoice
========================
=======================
POS Session Pay invoice
=======================
This modules allows to pay an existing Supplier Invoice / Customer Refund, or 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 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 #. 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 #. 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 .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
@ -38,6 +49,7 @@ Contributors
------------ ------------
* Enric Tobella <etobella@creublanca.es> * Enric Tobella <etobella@creublanca.es>
* Jordi Ballester <jordi.ballester@eficent.com>
Maintainer 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 mission is to support the collaborative development of Odoo features and
promote its widespread use. 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.

5
pos_session_pay_invoice/__manifest__.py

@ -3,8 +3,8 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). # 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', 'category': 'Point Of Sale',
'author': "Creu Blanca," 'author': "Creu Blanca,"
"Odoo Community Association (OCA)", "Odoo Community Association (OCA)",
@ -18,6 +18,5 @@
"wizard/cash_invoice_out.xml", "wizard/cash_invoice_out.xml",
"wizard/cash_invoice_in.xml", "wizard/cash_invoice_in.xml",
"views/pos_session.xml", "views/pos_session.xml",
"views/account_bank_statement.xml",
], ],
} }

17
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 = self.env.ref('point_of_sale.pos_config_main')
self.config.cash_control = True 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): def test_pos_invoice(self):
self.config.open_session_cb() self.config.open_session_cb()
session = self.config.current_session_id session = self.config.current_session_id
self.assertIsNotNone(session.statement_ids) 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() session.action_pos_session_open()
in_invoice = self.env['cash.invoice.in'].with_context( in_invoice = self.env['cash.invoice.in'].with_context(
active_ids=session.ids, active_model='pos.session' active_ids=session.ids, active_model='pos.session'
@ -81,6 +96,6 @@ class TestSessionPayInvoice(common.TransactionCase):
}) })
box.run() box.run()
session.action_pos_session_closing_control() 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_out.residual, 25.)
self.assertEqual(self.invoice_in.residual, 0.) self.assertEqual(self.invoice_in.residual, 0.)

21
pos_session_pay_invoice/views/account_bank_statement.xml

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<act_window
id="action_cash_invoice_in_from_statement"
name="Pay invoice"
res_model="cash.invoice.in"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
/>
<act_window
id="action_cash_invoice_out_from_statement"
name="Collect Payment from Invoice"
res_model="cash.invoice.out"
src_model="account.bank.statement"
view_mode="form"
target="new"
key2="client_action_multi"
/>
</odoo>

2
pos_session_pay_invoice/wizard/cash_invoice_out.xml

@ -2,7 +2,7 @@
<odoo> <odoo>
<act_window <act_window
id="action_pos_invoice_out" id="action_pos_invoice_out"
name="Pay invoice"
name="Collect Payment from Invoice"
res_model="cash.invoice.out" res_model="cash.invoice.out"
src_model="pos.session" src_model="pos.session"
view_mode="form" view_mode="form"

Loading…
Cancel
Save