summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2019-01-31 10:15:57 +0000
committerToufik Ben Jaa <tbe@odoo.com>2019-02-08 12:49:03 +0000
commitcc3ca63544f8a1b7c2ff888c80d80c90cc279ff3 (patch)
tree82b39307879af62fa9e3d03aaea1ba249713ef8a
parentef617134181753d1767ed50f067cf17d8cdf33bc (diff)
[FIX] sale: fix wording of link when sending a quotation by email
Since commit 34c47eecd30bdf66bc057bf285a51cff956cd0e8 wording of link when sending a quotation by email is broken. Indeed has document in draft is not correctly considered as having to be signed and/or paid the link is not labelled correctly. This commit fixes it. Parameter is also renamed to be more understandable. This commit is linked to task ID 1910532 and PR #29849 . closes odoo/odoo#30953
-rw-r--r--addons/sale/data/mail_data.xml4
-rw-r--r--addons/sale/models/sale.py8
2 files changed, 6 insertions, 6 deletions
diff --git a/addons/sale/data/mail_data.xml b/addons/sale/data/mail_data.xml
index a2abc42ff23..938a39e1576 100644
--- a/addons/sale/data/mail_data.xml
+++ b/addons/sale/data/mail_data.xml
@@ -59,11 +59,11 @@
<template id="" inherit_id="mail.mail_notification_paynow" name="oezirhgoi">
<xpath expr="//t[@t-set='access_name']" position="after">
<t t-if="record._name == 'sale.order'">
- <t t-if="record.has_to_be_signed()">
+ <t t-if="record.has_to_be_signed(include_draft=True)">
<t t-if="record.has_to_be_paid()" t-set="access_name">Sign and pay online</t>
<t t-else="" t-set="access_name">Accept and sign online</t>
</t>
- <t t-elif="record.has_to_be_paid()">
+ <t t-elif="record.has_to_be_paid(include_draft=True)">
<t t-set="access_name">Pay online</t>
</t>
</t>
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index 42d1ec8e413..15ebf47fa60 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -740,12 +740,12 @@ class SaleOrder(models.Model):
return report_pages
- def has_to_be_signed(self, also_in_draft=False):
- return (self.state == 'sent' or (self.state == 'draft' and also_in_draft)) and not self.is_expired and self.require_signature and not self.signature
+ def has_to_be_signed(self, include_draft=False):
+ return (self.state == 'sent' or (self.state == 'draft' and include_draft)) and not self.is_expired and self.require_signature and not self.signature
- def has_to_be_paid(self, also_in_draft=False):
+ def has_to_be_paid(self, include_draft=False):
transaction = self.get_portal_last_transaction()
- return (self.state == 'sent' or (self.state == 'draft' and also_in_draft)) and not self.is_expired and self.require_payment and transaction.state != 'done' and self.amount_total
+ return (self.state == 'sent' or (self.state == 'draft' and include_draft)) and not self.is_expired and self.require_payment and transaction.state != 'done' and self.amount_total
@api.multi
def _notify_get_groups(self, message, groups):