fix(contract-template): fix a bug where contract template where not using the productor max cheque quantity
All checks were successful
Deploy Amap / deploy (push) Successful in 1m42s
All checks were successful
Deploy Amap / deploy (push) Successful in 1m42s
This commit is contained in:
@@ -108,6 +108,11 @@ async def get_base_contract_template(
|
||||
'price': None,
|
||||
'products': [{'product': pr, 'quantity': None} for pr in sh.products]
|
||||
} for sh in form.shipments]
|
||||
cheque_payment_method = list(filter(
|
||||
lambda x: x.name == "cheque", form.productor.payment_methods))
|
||||
cheque_number = cheque_payment_method[0].max if len(
|
||||
cheque_payment_method) > 0 else 3
|
||||
print(cheque_number, cheque_payment_method)
|
||||
empty_contract = models.ContractPublic(
|
||||
firstname='',
|
||||
form=form,
|
||||
@@ -116,15 +121,13 @@ async def get_base_contract_template(
|
||||
phone='',
|
||||
products=[],
|
||||
payment_method='cheque',
|
||||
cheque_quantity=3,
|
||||
cheque_quantity=cheque_number,
|
||||
total_price=0,
|
||||
id=1
|
||||
)
|
||||
cheques = [
|
||||
{'name': None, 'value': None},
|
||||
{'name': None, 'value': None},
|
||||
{'name': None, 'value': None}
|
||||
]
|
||||
] * cheque_number
|
||||
try:
|
||||
pdf_bytes = generate_html_contract(
|
||||
empty_contract,
|
||||
|
||||
Reference in New Issue
Block a user