Apply promotional prices when invoicing on delivery Blueprint


When a company has chosen to invoice on delivery it could happen that the quantity of delivered products is higher than ordered. Tryton correclty invoice the delivered quantity.

An issue might arise when the customer finally receive a quantity that could have triggered a promotional price (through the use of the sale_pricelist or the sale_promotion module or maybe even both).

In that case companies usually wants to offer their customer the rebate they are entitled to receive.


After discussion it has been decided to add a field in sale.configuration to specify what should be the behaviour of tryton when such a situation occurs. It’s a boolean field defining what is the quantity that should be invoiced.

It is not complicated to overload the get_invoice_line method of sale.line to use the price from the pricelist according to the quantity shipped.

Recomputing the promotion is more tricky, breaks the modularity and should only be considered for specific modules.


I think this is questionable and it should be configured as company policy.
And probably it should raise a warning in case it is not allowed.

If we make a configuration of the policy above, there is no need to have a new module but the sale_promotion module could just add this option.

The new unit_price should be used only if it is a better price for the customer.

Maybe in this case a negative line for the previous invoiced quantity with the difference prices should be added to the last invoice. Such line should not be linked to the stock moves, but the unit price of the move must be updated.

I was thinking about something along the case but a bit more difficult to implement (and understand for the customer :stuck_out_tongue:) probably: compensating on the new line the loss of the customer eventually even by creating a line with a negative unit price.

There are also price lists that could reduce the price of the line according to the quantity.

Is it possible to have price lists that increase the price when buying more items?

We could have the choice between:

  • stuck to sale line unit price
  • use price computed on the effective quantity delivered
  • use the most advantageous price for the customer
  • use the most advantageous price for the company

More reasons to make this option depending on the promotion.

User is free to create such list even if there are few chances.

The 2 and 4 makes no sense for me. When there is a prior sale confirmed, there is a contract between the customer and the company. The company can only be fair by reducing the price but not increase it.

I don’t understand how the price lists are related to the promotions.

I mean that the recomputation of promotion should be done based on a configuration from promotion module.

But indeed after rethink, I think the re-computation is not a practical option. This is too specific and related only to a very unusual case.
So for me, only the option that defines what to do when a bigger quantity is shipped than the ordered should be implemented.

I’m wondering if we should not have the same feature but for purchase. But of course the configuration should be stored on the supplier instead of a global configuration.