mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[9.0][IMP] rma: add constrains
This commit is contained in:
@@ -140,6 +140,17 @@ class RmaOrderLine(models.Model):
|
|||||||
self.update(data)
|
self.update(data)
|
||||||
self._remove_other_data_origin('invoice_line_id')
|
self._remove_other_data_origin('invoice_line_id')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
@api.constrains('invoice_line_id', 'partner_id')
|
||||||
|
def _check_invoice_partner(self):
|
||||||
|
for rec in self:
|
||||||
|
if (rec.invoice_line_id and
|
||||||
|
rec.invoice_line_id.invoice_id.partner_id !=
|
||||||
|
rec.partner_id):
|
||||||
|
raise ValidationError(_(
|
||||||
|
"RMA customer and originating invoice line customer "
|
||||||
|
"doesn't match."))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _remove_other_data_origin(self, exception):
|
def _remove_other_data_origin(self, exception):
|
||||||
res = super(RmaOrderLine, self)._remove_other_data_origin(exception)
|
res = super(RmaOrderLine, self)._remove_other_data_origin(exception)
|
||||||
|
|||||||
Reference in New Issue
Block a user