summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2017-01-04 13:49:14 +0100
committerNicolas Martinelli <nim@odoo.com>2017-01-04 14:01:43 +0100
commit56517a6ca96fca6e50e6827ab80d297cfd84e5be (patch)
tree596ca3120c44b8acc0d92935758a3cf64cfb42a5 /addons
parentda548374208f5ab51ef607459037b6604f185116 (diff)
[FIX] website_quote: invoice generation
To reproduce: - Configure an external payment provider (e.g. Ingenico) with "Authorize & capture the amount, confirm the SO and auto-validate the invoice on acquirer confirmation" - Create a quotation with a product linked to a subscription - Send the link to the customer - Click on "Accept & Pay", use the configured provider The SO is confirmed, but the invoice is not generated. By calling `action_confirm` in the callback of the transaction, we validate the SO before `form_feedback` is called. Therefore, the method `_confirm_so` will do nothing since the SO is not in state 'draft' or 'sent' anymore. The solution is to manually call `_confirm_so`instead of `action_confirm`. This is necessary to do it at this moment since we might not go through `form_feedback` (e.g. if we pay thanks to wire transfer). opw-694273
Diffstat (limited to 'addons')
-rw-r--r--addons/website_quote/models/sale_order.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/website_quote/models/sale_order.py b/addons/website_quote/models/sale_order.py
index 0a386063238..54a5ac77287 100644
--- a/addons/website_quote/models/sale_order.py
+++ b/addons/website_quote/models/sale_order.py
@@ -165,8 +165,7 @@ class SaleOrder(models.Model):
""" Payment callback: validate the order and write transaction details in chatter """
# create draft invoice if transaction is ok
if transaction and transaction.state == 'done':
- if self.state in ['draft', 'sent']:
- self.sudo().action_confirm()
+ transaction._confirm_so()
message = _('Order paid by %s. Transaction: %s. Amount: %s.') % (transaction.partner_id.name, transaction.acquirer_reference, transaction.amount)
self.message_post(body=message)
return True