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):