fix(report): Purchase YGB VAT report only lists documents with YGB
Replace the purchase_type/agricultural_goods gate with a YGB-presence filter: a Purchase Invoice is included only when at least one of its YGB fields (ygb / line_code) is filled. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2d743f2878
commit
beec3f4416
|
|
@ -63,12 +63,19 @@ def get_columns(filters=None):
|
|||
def get_data(filters=None):
|
||||
"""Get report data — one row per qualifying Purchase Invoice.
|
||||
|
||||
A document qualifies when it is submitted and at least one of the
|
||||
purchase_type / agricultural_goods flags is set. Items are not filtered.
|
||||
A document qualifies when it is submitted and carries YGB data, i.e. at
|
||||
least one of the ygb / line_code fields is filled. Items are not filtered.
|
||||
"""
|
||||
filters = filters or {}
|
||||
|
||||
conditions = "pi.docstatus = 1 AND (pi.agricultural_goods = 1 OR pi.purchase_type = 1)"
|
||||
# Only documents that actually carry YGB data: at least one of the YGB
|
||||
# fields (ygb / line_code) is filled.
|
||||
conditions = (
|
||||
"pi.docstatus = 1 AND ("
|
||||
"(pi.ygb IS NOT NULL AND pi.ygb != 0) "
|
||||
"OR (pi.line_code IS NOT NULL AND pi.line_code != '')"
|
||||
")"
|
||||
)
|
||||
params = {}
|
||||
|
||||
if filters.get("company"):
|
||||
|
|
|
|||
Loading…
Reference in New Issue