fix problem with onchange_partner_shipping_id
parent
46f0620656
commit
96262fd5c3
|
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class AccountInvoiceLine(models.Model):
|
class AccountInvoiceLine(models.Model):
|
||||||
|
|
@ -87,11 +88,11 @@ class AccountInvoice(models.Model):
|
||||||
def onchange_partner_shipping_id(self):
|
def onchange_partner_shipping_id(self):
|
||||||
# res = super(AccountInvoice, self).onchange_partner_shipping_id()
|
# res = super(AccountInvoice, self).onchange_partner_shipping_id()
|
||||||
if not self.env.user.has_group('dp_custom.group_allow_third_country_sale'):
|
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!') % \
|
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
|
@api.multi
|
||||||
def action_invoice_open(self):
|
def action_invoice_open(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue