Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion account_banking_mandate_contact/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Account Banking Mandate Contact",
"summary": "Assign specific banking mandates in contact level",
"version": "16.0.1.0.4",
"version": "16.0.1.1.0",
"development_status": "Production/Stable",
"category": "Banking addons",
"website": "https://github.com/OCA/bank-payment",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2025 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
openupgrade.convert_to_company_dependent(
env, "res.partner", "old_contact_mandate_id", "contact_mandate_id"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2025 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

from openupgradelib import openupgrade


def migrate(cr, version):
openupgrade.rename_columns(
cr, {"res_partner": [("contact_mandate_id", "old_contact_mandate_id")]}
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def _prepare_payment_line_vals(self, payment_order):
vals = super(AccountMoveLine, self)._prepare_payment_line_vals(payment_order)
if payment_order.payment_type != "inbound" or self.move_id.mandate_id:
return vals
self = self.with_company(self.company_id)
mandate = (
self.move_id.partner_shipping_id.valid_mandate_id
or self.move_id.partner_id.valid_mandate_id
Expand Down
5 changes: 4 additions & 1 deletion account_banking_mandate_contact/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models
from odoo import api, fields, models


class ResPartner(models.Model):
Expand All @@ -10,9 +10,12 @@ class ResPartner(models.Model):
contact_mandate_id = fields.Many2one(
comodel_name="account.banking.mandate",
string="Contact Mandate",
company_dependent=True,
)

@api.depends_context("company")
def _compute_valid_mandate_id(self):
self = self.with_company(self.env.company)
partners_to_process = self.filtered(
lambda x: x.contact_mandate_id.state == "valid"
)
Expand Down
1 change: 1 addition & 0 deletions account_banking_mandate_sale_contact/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def _compute_mandate_id(self):
or order.company_id.sale_default_mandate_contact
)
if partner_mandate_config:
order = order.with_company(order.company_id)
mandate = False
if partner_mandate_config == "partner_id":
mandate = order.partner_id.contact_mandate_id
Expand Down