[FIX] sale: fix wording of link when sending a quotation by email

Since commit 34c47eecd3 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
This commit is contained in:
Thibault Delavallée
2019-02-08 12:49:03 +00:00
committed by Toufik Ben Jaa
parent ef61713418
commit cc3ca63544
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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>
+4 -4
View File
@@ -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):