Skip to content

Commit 2bc55d3

Browse files
committed
[MIG] account_invoice_view_payment: Migration to 16.0
1 parent 63b94d8 commit 2bc55d3

File tree

6 files changed

+71
-29
lines changed

6 files changed

+71
-29
lines changed

account_invoice_view_payment/README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Account Invoice View Payment
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
20-
:target: https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_view_payment
20+
:target: https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_view_payment
2121
:alt: OCA/account-invoicing
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_view_payment
23+
:target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_view_payment
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=15.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=16.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -66,7 +66,7 @@ Bug Tracker
6666
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
6767
In case of trouble, please check there if your issue has already been reported.
6868
If you spotted it first, help us to smash it by providing a detailed and welcomed
69-
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_view_payment%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
69+
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_view_payment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
7070

7171
Do not contact contributors directly about support or help with technical issues.
7272

@@ -100,6 +100,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
100100
mission is to support the collaborative development of Odoo features and
101101
promote its widespread use.
102102

103-
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_view_payment>`_ project on GitHub.
103+
This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_view_payment>`_ project on GitHub.
104104

105105
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

account_invoice_view_payment/__manifest__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"name": "Account Invoice View Payment",
77
"summary": "Access to the payment from an invoice",
8-
"version": "15.0.1.1.1",
8+
"version": "16.0.1.0.0",
99
"license": "AGPL-3",
1010
"website": "https://github.com/OCA/account-invoicing",
1111
"author": "ForgeFlow, " "Odoo Community Association (OCA)",

account_invoice_view_payment/models/account_payment.py

+25
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,28 @@ def post_and_open_payment(self):
2020
"type": "ir.actions.act_window",
2121
}
2222
return res
23+
24+
25+
class AccountPaymentRegister(models.TransientModel):
26+
_inherit = "account.payment.register"
27+
28+
def create_payment_and_open(self):
29+
account_move_model = self.env["account.move"]
30+
payment_model = self.env["account.payment"]
31+
payments = payment_model
32+
for _payment_vals in account_move_model.search(
33+
[("id", "in", self.env.context.get("active_ids", False))]
34+
):
35+
vals = self._create_payment_vals_from_wizard()
36+
payments += payment_model.create(vals)
37+
payments.action_post()
38+
res = {
39+
"domain": [("id", "in", payments.ids), ("state", "=", "posted")],
40+
"name": _("Payments"),
41+
"view_mode": "tree,form",
42+
"res_model": "account.payment",
43+
"view_id": False,
44+
"context": False,
45+
"type": "ir.actions.act_window",
46+
}
47+
return res

account_invoice_view_payment/static/description/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Account Invoice View Payment</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:0cca4874ac9c8da20233b28a13917e68e208348a2a0575f94b7bf241aa5bcea2
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_view_payment"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_view_payment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_view_payment"><img alt="OCA/account-invoicing" src="https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_view_payment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module allows users to access directly to the payment from an invoice
374374
when registering a payment or afterwards.</p>
375375
<p>The option to open the payment when it’s being registered is useful
@@ -413,7 +413,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
413413
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoicing/issues">GitHub Issues</a>.
414414
In case of trouble, please check there if your issue has already been reported.
415415
If you spotted it first, help us to smash it by providing a detailed and welcomed
416-
<a class="reference external" href="https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_view_payment%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
416+
<a class="reference external" href="https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_view_payment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417417
<p>Do not contact contributors directly about support or help with technical issues.</p>
418418
</div>
419419
<div class="section" id="credits">
@@ -443,7 +443,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
443443
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
444444
mission is to support the collaborative development of Odoo features and
445445
promote its widespread use.</p>
446-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/15.0/account_invoice_view_payment">OCA/account-invoicing</a> project on GitHub.</p>
446+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-invoicing/tree/16.0/account_invoice_view_payment">OCA/account-invoicing</a> project on GitHub.</p>
447447
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
448448
</div>
449449
</div>

account_invoice_view_payment/tests/test_account_invoice_view_payment.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,43 @@ class TestAccountInvoiceViewPayment(TransactionCase):
1111
Tests for Account Invoice View Payment.
1212
"""
1313

14-
def setUp(self):
15-
super(TestAccountInvoiceViewPayment, self).setUp()
16-
group_ids = self.env.ref("account.group_account_invoice").ids
17-
self.test_user_1 = self.env["res.users"].create(
14+
def setUpClass(cls):
15+
super(TestAccountInvoiceViewPayment, cls).setUpClass()
16+
group_ids = cls.env.ref("account.group_account_invoice").ids
17+
cls.test_user_1 = cls.env["res.users"].create(
1818
{"name": "John", "login": "test1", "groups_id": [(6, 0, group_ids)]}
1919
)
20-
self.par_model = self.env["res.partner"]
21-
self.acc_model = self.env["account.account"]
22-
self.inv_model = self.env["account.move"]
23-
self.inv_line_model = self.env["account.move.line"]
24-
self.pay_model = self.env["account.payment"]
25-
self.reg_pay_model = self.env["account.payment.register"]
26-
27-
self.cash = self.env["account.journal"].create(
20+
cls.par_model = cls.env["res.partner"]
21+
cls.acc_model = cls.env["account.account"]
22+
cls.inv_model = cls.env["account.move"]
23+
cls.inv_line_model = cls.env["account.move.line"]
24+
cls.pay_model = cls.env["account.payment"]
25+
cls.reg_pay_model = cls.env["account.payment.register"]
26+
27+
cls.cash = cls.env["account.journal"].create(
2828
{"name": "Cash Test", "type": "cash", "code": "CT"}
2929
)
30-
self.payment_method_manual_in = self.env.ref(
30+
cls.payment_method_manual_in = cls.env.ref(
3131
"account.account_payment_method_manual_in"
3232
)
3333

34-
self.partner1 = self._create_partner()
34+
cls.partner1 = cls._create_partner()
3535

36-
self.invoice_account = self.acc_model.search(
36+
cls.invoice_account = cls.acc_model.search(
3737
[
3838
(
3939
"user_type_id",
4040
"=",
41-
self.env.ref("account.data_account_type_revenue").id,
41+
cls.env.ref("account.data_account_type_revenue").id,
4242
)
4343
],
4444
limit=1,
4545
)
4646

47-
self.invoice1 = self._create_invoice(self.partner1, "out_invoice")
48-
self.invoice2 = self._create_invoice(self.partner1, "in_invoice")
49-
self.invoice3 = self._create_invoice(self.partner1, "in_invoice")
50-
self.invoice2.invoice_date = self.invoice3.invoice_date = fields.Date.today()
47+
cls.invoice1 = cls._create_invoice(cls.partner1, "out_invoice")
48+
cls.invoice2 = cls._create_invoice(cls.partner1, "in_invoice")
49+
cls.invoice3 = cls._create_invoice(cls.partner1, "in_invoice")
50+
cls.invoice2.invoice_date = cls.invoice3.invoice_date = fields.Date.today()
5151

5252
def _create_partner(self):
5353
partner = self.par_model.create(

account_invoice_view_payment/views/account_payment_view.xml

+17
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,21 @@
1717
</field>
1818
</record>
1919

20+
<record id="view_account_payment_form_multi" model="ir.ui.view">
21+
<field name="name">account.payment.form.multi</field>
22+
<field name="model">account.payment.register</field>
23+
<field name="inherit_id" ref="account.view_account_payment_register_form" />
24+
<field name="arch" type="xml">
25+
<button name="action_create_payments" position="after">
26+
<button
27+
name="create_payment_and_open"
28+
string="Validate &amp; View Payment"
29+
type="object"
30+
class="oe_highlight"
31+
groups="account.group_account_invoice"
32+
/>
33+
</button>
34+
</field>
35+
</record>
36+
2037
</odoo>

0 commit comments

Comments
 (0)