1
0
forked from erp-dev/erp

fix: business cancel service merged

This commit is contained in:
2026-06-11 15:33:31 +08:00
parent 65564f772a
commit 80db7867f4
18 changed files with 574 additions and 125 deletions

View File

@@ -705,24 +705,23 @@ def _normalize_external_statement_order_group(
zk_value = abs(_to_decimal(record.get('ZkJinE'), field_name='ZkJinE', default=Decimal('0')))
total_amount += amount_value
zk_amount += zk_value
matched_product = _find_local_product_by_external_product_id(
merchant=customer.merchant,
external_product_id=str(record.get('HpID') or '').strip(),
)
product_name = getattr(matched_product, 'name', '') or str(record.get('HpID') or '').strip()
unit = str(record.get('JiJiaDW') or '').strip() or getattr(matched_product, 'get_unit_display', lambda: '')()
external_product_id = str(record.get('HpID') or '').strip()
product_name = str(record.get('HpName') or '').strip() or external_product_id
color = str(record.get('YanSe') or '').strip()
spec = str(record.get('SeHao') or '').strip()
unit = str(record.get('JiJiaDW') or '').strip()
item_payload = {
'product_id': getattr(matched_product, 'id', None),
'product_id': None,
'product_name': product_name,
'quantity': _decimal_to_string(quantity_value),
'price': _decimal_to_string(price_value),
'unit': unit,
'color': '',
'spec': getattr(matched_product, 'spec', '') or '',
'color': color,
'spec': spec,
'quantity_of_rolls': [],
'num_of_rolls': int(rolls_value) if rolls_value == rolls_value.to_integral_value() else 0,
'external_sub_id': record.get('SubID'),
'external_product_id': str(record.get('HpID') or '').strip(),
'external_product_id': external_product_id,
}
items_payload.append(item_payload)
for note_key in ('BeiZhu', 'BeiZhuC', 'BeiZhuD', 'MeoD'):