From 96262fd5c3bb18a7244dc045e5493444a61058c5 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 10 Mar 2021 12:58:15 +0100 Subject: [PATCH] fix problem with onchange_partner_shipping_id --- ext/custom-addons/dp_custom/models/account.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index 5c5f09cb..d207044d 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -20,6 +20,7 @@ ############################################################################## from odoo import api, fields, models, _ from odoo.exceptions import UserError +from odoo.exceptions import ValidationError class AccountInvoiceLine(models.Model): @@ -87,11 +88,11 @@ class AccountInvoice(models.Model): def onchange_partner_shipping_id(self): # res = super(AccountInvoice, self).onchange_partner_shipping_id() if not self.env.user.has_group('dp_custom.group_allow_third_country_sale'): - if self.partner_invoice_id.country_id != self.partner_shipping_id.country_id: + if self.partner_id.country_id != self.partner_shipping_id.country_id: message = _('Rechnungs- und Lieferland passen nicht zusammen: %s <-> %s!') % \ - (self.partner_invoice_id.country_id.name, self.partner_shipping_id.country_id.name) + (self.partner_id.country_id.name, self.partner_shipping_id.country_id.name) - raise Warning(_(message)) + raise ValidationError(message) @api.multi def action_invoice_open(self):