[MIG] account_payment_purchase: Migration to 15.0

This commit is contained in:
Koen Loodts
2021-12-16 15:58:09 +01:00
parent 6e5d50b6bb
commit 9be9766535
7 changed files with 16 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ Account Payment Purchase
:target: https://runbot.odoo-community.org/runbot/173/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds 2 fields on purchase orders: *Bank Account* and *Payment
Mode*. These fields are copied from partner to purchase order and then from
@@ -113,6 +113,6 @@ 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.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/14.0/account_payment_purchase>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/15.0/account_payment_purchase>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,7 +4,7 @@
{
"name": "Account Payment Purchase",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"category": "Banking addons",
"license": "AGPL-3",
"summary": "Adds Bank Account and Payment Mode on Purchase Orders",

View File

@@ -1,3 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_invoice, purchase_order
from . import account_move, purchase_order

View File

@@ -19,12 +19,14 @@ class AccountMove(models.Model):
"message": _("Selected purchase order have different payment mode."),
}
return res
self.payment_mode_id = new_mode
elif self.payment_mode_id.id != new_mode:
self.payment_mode_id = new_mode
if self.partner_bank_id and new_bank and self.partner_bank_id.id != new_bank:
res["warning"] = {
"title": _("Warning"),
"message": _("Selected purchase order have different supplier bank."),
}
return res
self.partner_bank_id = new_bank
elif self.partner_bank_id.id != new_bank:
self.partner_bank_id = new_bank
return res

View File

@@ -29,7 +29,7 @@ class PurchaseOrder(models.Model):
@api.onchange("partner_id", "company_id")
def onchange_partner_id(self):
super(PurchaseOrder, self).onchange_partner_id()
ret = super(PurchaseOrder, self).onchange_partner_id()
if self.partner_id:
self.supplier_partner_bank_id = self._get_default_supplier_partner_bank(
self.partner_id
@@ -38,3 +38,4 @@ class PurchaseOrder(models.Model):
else:
self.supplier_partner_bank_id = False
self.payment_mode_id = False
return ret

View File

@@ -3,23 +3,18 @@
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import fields
from odoo.tests import Form, SavepointCase
from odoo.tests import Form, TransactionCase
class TestAccountPaymentPurchase(SavepointCase):
class TestAccountPaymentPurchase(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestAccountPaymentPurchase, cls).setUpClass()
cls.journal = cls.env["account.journal"].create(
{"name": "Test journal", "code": "TEST", "type": "general"}
)
cls.payment_method_out = cls.env["account.payment.method"].create(
{
"name": "Test payment method",
"code": "test",
"payment_type": "outbound",
"bank_account_required": True,
}
cls.payment_method_out = cls.env.ref(
"account.account_payment_method_manual_out"
)
cls.payment_mode = cls.env["account.payment.mode"].create(
{

2
test-requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
git+https://github.com/OCA/bank-payment@refs/pull/873/head#subdirectory=setup/account_payment_partner
git+https://github.com/OCA/bank-payment@refs/pull/870/head#subdirectory=setup/account_payment_mode