Add additional advance payment in sale

I created a sale with two advance payments configured. The two advance payment invoices got paid and tryton created automatically the last invoice. At this point it was decided to add a third advance payment. How do I do that?

I looked into the sale_amendment module, but I can not change the advance payment with it.

Then I created a third invoice manually and put as product an empty line with the advance payment account and connected it to the sale line, so that it looks like the automatically created advance payment invoices. In the last invoice created by tryton I added the product from my manually created advance payment with a quantity of -1.

This seemed to work fine, but now my sale is still in state partially paid although all the invoices got paid.

How can I do this properly? Is it still possible to move the sale to state done manually?

There is a feature request to support amendment on advance payment: Sale amendment to correct sale advance payment terms (#12157) · Issues · Tryton / Tryton · GitLab

This is probably not enough because you do not have created a new condition to which the advance invoice line should be linked to.
Also if the final invoice is already created, it will miss the recall of this new condition.

Probably not all the invoices linked to the sale have been paid.
Or you may had a problem during the processing of the sale, you should relaunch the processing as sale administrator.

Thats great! Thank you.

Most probably, because all the linked invoices are definitely paid. I get the following error when I try to relaunch:

Traceback (most recent call last):
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 109, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 43, in rpc
    return methodsget(requestrpc_method, _dispatch)(
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 75, in wrapper
    return func(request, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/wrapperspy", line 197, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 204, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 720, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 1038, in process
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 1050, in _process_invoice
    invoice = salecreate_invoice()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_advance_payment/salepy", line 380, in create_invoice
    invoice = super(Sale, self)create_invoice()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 870, in create_invoice
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_advance_payment/salepy", line 449, in get_invoice_line
    lines = super(SaleLine, self)get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/analytic_sale/salepy", line 27, in get_invoice_line
    invoice_lines = super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 1680, in get_invoice_line
    - self_get_invoiced_quantity())
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 1752, in _get_invoiced_quantity
    quantity += Uomcompute_qty(invoice_lineunit,
  File "/usr/local/lib/python39/dist-packages/trytond/modules/product/uompy", line 198, in compute_qty
    raise ValueError("missing from_uom")
ValueError: missing from_uom

Indeed the code is not expecting invoice line without unit but with a sale line as origin: Invoiced quantity fails if invoice line has no unit (#12462) · Issues · Tryton / Tryton · GitLab

1 Like

Wow, thank you so much for looking into my problem and creating an issue report!

I started fresh right before I created the third advance payment invoice and instead of linking the advance payment line to the sale, I linked it to one of the two advance payment conditions. Like you said, I had to delete the created invoice but then the recreated invoice had automatically the 3rd advance payment in it. So everything seems fine now :+1: