[FIX] account: Fix missing dependencies of _check_duplicate_supplier_reference
- Create a vendor bill for partner A with reference 'AAAAA' - Create another vendor bill for partner A with the same reference: => Constraint is triggered. - Create another vendor bill without partner with the same reference. - Edit the vendor bill and set a partner: => Constraint not triggered. closes odoo/odoo#40897 X-original-commit: 3f6254c8faa7dfb2484f4ac18d4c0fd717149e4b Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -1339,7 +1339,7 @@ class AccountMove(models.Model):
|
||||
if res:
|
||||
raise ValidationError(_('Posted journal entry must have an unique sequence number per company.'))
|
||||
|
||||
@api.constrains('ref')
|
||||
@api.constrains('ref', 'type', 'partner_id', 'journal_id', 'invoice_date')
|
||||
def _check_duplicate_supplier_reference(self):
|
||||
moves = self.filtered(lambda move: move.is_purchase_document() and move.ref)
|
||||
if not moves:
|
||||
|
||||
Reference in New Issue
Block a user