This commit is contained in:
gsinghpal
2026-04-03 15:45:18 -04:00
parent 4cd7357aa0
commit c66bdf5089
71 changed files with 6721 additions and 118 deletions

View File

@@ -34,9 +34,14 @@ class AccountMoveAuditHook(models.Model):
for line in move.line_ids:
if not line.account_id:
issues.append(f'Line missing account: {line.name}')
if line.product_id and not line.tax_ids:
if move.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund'):
issues.append(f'Missing tax on product line: {line.product_id.name}')
# M6: Only flag missing tax when the product has taxes configured
# (avoids false positives for HST-exempt healthcare services)
if (line.product_id and not line.tax_ids
and move.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')):
# Check if the product has default taxes configured
product_taxes = line.product_id.taxes_id if move.move_type in ('out_invoice', 'out_refund') else line.product_id.supplier_taxes_id
if product_taxes:
issues.append(f'Missing tax on product line: {line.product_id.name} (product has taxes configured but line has none)')
if not move.line_ids:
issues.append('Entry has no lines')