Commit 67cb642b authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_base: check more tax condition and display correcly cell resource reference

parent ac36a0d8
...@@ -94,7 +94,8 @@ def getTaxLineList(order): ...@@ -94,7 +94,8 @@ def getTaxLineList(order):
order.contentValues(portal_type=order.getPortalTaxMovementTypeList()) order.contentValues(portal_type=order.getPortalTaxMovementTypeList())
if line.getTotalPrice()] if line.getTotalPrice()]
for line in order.Base_getSpecialisedAggregatedAmountList(): for line in order.Base_getSpecialisedAggregatedAmountList():
if any(line.isMemberOf(tax_use) for tax_use in tax_use_list): #if any(line.isMemberOf(tax_use) for tax_use in tax_use_list):
if any(line.isMemberOf(tax_use) for tax_use in tax_use_list) or line.getTradePhase() == "trade/tax":
tax_line_list.append(line) tax_line_list.append(line)
tax_line_list.sort(key=lambda line:line.getTitle()) tax_line_list.sort(key=lambda line:line.getTitle())
return tax_line_list return tax_line_list
...@@ -146,12 +147,15 @@ for line in getSubLineList(context): ...@@ -146,12 +147,15 @@ for line in getSubLineList(context):
'specialise_title': '', 'specialise_title': '',
} }
else: else:
line_reference = line.getResource() and line.getResourceValue().getReference() or ''
if line.getPortalType().endswith('Cell'): if line.getPortalType().endswith('Cell'):
display_id = 'translated_title' display_id = 'translated_title'
if request.get('international_form'): if request.get('international_form'):
display_id = 'title' display_id = 'title'
variation_description = ', '.join([x[0] for x in line.getVariationCategoryItemList(display_id=display_id)]) variation_description = ', '.join([x[0] for x in line.getVariationCategoryItemList(display_id=display_id)])
desc = ('%s %s' % (desc[0], variation_description), ) desc = ('%s %s' % (desc[0], variation_description), )
if line.getVariation() and line.getVariationValue().getReference():
line_reference = line.getVariationValue().getReference()
is_tax = any(line.isMemberOf(tax_use) for tax_use in tax_use_list) is_tax = any(line.isMemberOf(tax_use) for tax_use in tax_use_list)
#set the not_tax_line with the tax_number and the tax_line with the tax_name #set the not_tax_line with the tax_number and the tax_line with the tax_name
...@@ -176,8 +180,7 @@ for line in getSubLineList(context): ...@@ -176,8 +180,7 @@ for line in getSubLineList(context):
'right_style_name': 'Table_20_Contents_20_Right', 'right_style_name': 'Table_20_Contents_20_Right',
'index': line.getReference() or line.getIntIndex(), 'index': line.getReference() or line.getIntIndex(),
'source_reference': getSourceReference(line), 'source_reference': getSourceReference(line),
'reference': line.getResource() is not None\ 'reference': line_reference,
and line.getResourceValue().getReference() or '',
'description': desc, 'description': desc,
'base_contribution':line.getBaseContribution() or None, 'base_contribution':line.getBaseContribution() or None,
'use_type':line.getResourceValue().getUse() or '', 'use_type':line.getResourceValue().getUse() or '',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment