sale_credit_limit is blocking customization for sale line types
I have a custom sale line type which is similar to a title line. With the module sale_credit_limit activated it generates a crash like:
Traceback (most recent call last):
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/protocols/dispatcher.py", line 180, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/model/modelsql.py", line 870, in read
getter_results = field.get(
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/model/fields/function.py", line 105, in get
return dict((name, call(name)) for name in names)
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/model/fields/function.py", line 105, in <genexpr>
return dict((name, call(name)) for name in names)
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/model/fields/function.py", line 98, in call
return method(records, name)
File "/home/vant/Documentos/GitLab/dddddd/.venv/lib/python3.8/site-packages/trytond/modules/sale_credit_limit/party.py", line 45, in get_credit_amount
quantity -= Uom.compute_qty(
TypeError: unsupported operand type(s) for -=: 'float' and 'NoneType'
Because that invoice line don't have unit or quantity.
My proposal is that sale_credit_limit filter only 'line' types.
for invoice_line in line.invoice_lines:
if invoice_line.type != 'line':
continue
invoice = invoice_line.invoice
Another option is to check if invoice_line have unit and quantity just before compute_qty. Which is the best option?