[FIX] website_quote: condition to display the Pay Now button

Before this revision, the button "Pay now" on the quotation
in the frond-end was display only if the sale order
was in the state `manual` and that there was not
yet any payment transaction.

The thing is, since the release of 9.0,
the `manual`state no longer exists in `sale.order`,
and the pay now button was therefore never displayed.

From this revision, the condition to display the button
is based on the `invoice_status`, which need to be `to_invoice`,
meaning there is something to pay:
 - The sale.order needs to be in states `sale` or `done`
 - At least one line has to be invoiced:
   - If the product has the `invoice_policy` set to `order`
   - or if the product has the 'invoice_policy` set to `delivery`,
     and at least one quantity has been delivered.

opw-659931
This commit is contained in:
Denis Ledoux
2015-12-17 14:40:37 +01:00
parent 2f106aa5ac
commit 7be2403cf5
+1 -1
View File
@@ -53,7 +53,7 @@ class sale_quote(http.Controller):
'tx_id': tx_id,
'tx_state': tx.state if tx else False,
'tx_post_msg': tx.acquirer_id.post_msg if tx else False,
'need_payment': not tx_id and order.state == 'manual',
'need_payment': order.invoice_status == 'to invoice' and (not tx or tx.state in ['draft', 'cancel', 'error']),
'token': token,
}