Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ def ref_or_id(ref_or_id, model_name, AccountChartTemplate=AccountChartTemplate):
for model_name, field_names in spec.items():
filtered_records = {}
for record_id, record_data in template_data[model_name].items():
if not any(record_data.get(key) for key in field_names):
record = ref_or_id(record_id, model_name)
if not record or not any(record_data.get(key) for key in field_names):
# record doesn't exist yet in this company's chart;
# don't partially-create it here, only backfill existing ones
continue
filtered = {
key: value
for key, value in record_data.items()
if key in field_names and not ref_or_id(record_id, model_name)[key]
if key in field_names and not record[key]
}
if filtered:
filtered_records[record_id] = filtered
Expand Down
Loading