Order tests (#10649)

- Additional test coverage for order models
- Validate address
- Validate contact
- Validate date ranges
This commit is contained in:
Oliver
2025-10-22 14:32:26 +11:00
committed by GitHub
parent e0b0e1d66c
commit 6dfedead7c
3 changed files with 86 additions and 3 deletions
+7
View File
@@ -383,6 +383,13 @@ class Order(
'start_date': _('Start date must be before target date'),
})
# Check that the referenced 'address' matches the correct 'company'
if self.company and self.address:
if self.address.company != self.company:
raise ValidationError({
'address': _('Address does not match selected company')
})
def clean_line_item(self, line):
"""Clean a line item for this order.