From 8d412ee327fabc4a78f06f854ef3b844171cc254 Mon Sep 17 00:00:00 2001 From: louck Date: Fri, 18 Oct 2024 17:35:09 +0200 Subject: [PATCH] [MIG] account_invoice_merge_payment: Migration to 16.0 (from 12.0) --- account_invoice_merge_payment/__manifest__.py | 2 +- account_invoice_merge_payment/models/__init__.py | 2 +- .../models/{account_invoice.py => account_move.py} | 10 ++++------ .../tests/test_account_invoice_merge.py | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) rename account_invoice_merge_payment/models/{account_invoice.py => account_move.py} (56%) diff --git a/account_invoice_merge_payment/__manifest__.py b/account_invoice_merge_payment/__manifest__.py index a6cf0204b22..9b7e9c25111 100644 --- a/account_invoice_merge_payment/__manifest__.py +++ b/account_invoice_merge_payment/__manifest__.py @@ -7,7 +7,7 @@ "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/account-invoicing", "category": "Invoicing & Payments", - "version": "12.0.1.0.0", + "version": "16.0.1.0.0", "license": "AGPL-3", "depends": [ "account_invoice_merge", diff --git a/account_invoice_merge_payment/models/__init__.py b/account_invoice_merge_payment/models/__init__.py index 8e072db8f3e..9c0a4213854 100644 --- a/account_invoice_merge_payment/models/__init__.py +++ b/account_invoice_merge_payment/models/__init__.py @@ -1 +1 @@ -from . import account_invoice +from . import account_move diff --git a/account_invoice_merge_payment/models/account_invoice.py b/account_invoice_merge_payment/models/account_move.py similarity index 56% rename from account_invoice_merge_payment/models/account_invoice.py rename to account_invoice_merge_payment/models/account_move.py index 020cdcc9b99..bc429880dc4 100644 --- a/account_invoice_merge_payment/models/account_invoice.py +++ b/account_invoice_merge_payment/models/account_move.py @@ -4,18 +4,16 @@ from odoo import api, models -class AccountInvoice(models.Model): +class AccountMove(models.Model): - _inherit = "account.invoice" + _inherit = "account.move" @api.model def _get_invoice_key_cols(self): - return super(AccountInvoice, self)._get_invoice_key_cols() + [ - "payment_mode_id", - ] + return super()._get_invoice_key_cols() + ["payment_mode_id"] @api.model def _get_first_invoice_fields(self, invoice): - res = super(AccountInvoice, self)._get_first_invoice_fields(invoice) + res = super()._get_first_invoice_fields(invoice) res.update({"payment_mode_id": invoice.payment_mode_id.id}) return res diff --git a/account_invoice_merge_payment/tests/test_account_invoice_merge.py b/account_invoice_merge_payment/tests/test_account_invoice_merge.py index d37689f0f31..0a180cb2230 100644 --- a/account_invoice_merge_payment/tests/test_account_invoice_merge.py +++ b/account_invoice_merge_payment/tests/test_account_invoice_merge.py @@ -13,8 +13,8 @@ def setUp(self): self.par_model = self.env["res.partner"] self.context = self.env["res.users"].context_get() self.acc_model = self.env["account.account"] - self.inv_model = self.env["account.invoice"] - self.inv_line_model = self.env["account.invoice.line"] + self.inv_model = self.env["account.move"] + self.inv_line_model = self.env["account.move.line"] self.wiz = self.env["invoice.merge"] self.payment_mode_model = self.env["account.payment.mode"] self.journal_model = self.env["account.journal"] @@ -90,7 +90,7 @@ def test_account_invoice_merge_same_payment_mode(self): wiz_id = self.wiz.with_context( active_ids=[self.invoice1.id, self.invoice2.id], - active_model="account.invoice", + active_model="account.move", ).create({}) wiz_id.fields_view_get() wiz_id.merge_invoices() @@ -105,7 +105,7 @@ def test_account_invoice_merge_diff_payment_mode(self): ) wiz_id = self.wiz.with_context( active_ids=[self.invoice1.id, self.invoice3.id], - active_model="account.invoice", + active_model="account.move", ).create({}) with self.assertRaises(UserError): wiz_id.fields_view_get()