summaryrefslogtreecommitdiff
path: root/addons/purchase/static/src
diff options
context:
space:
mode:
authoryhu-odoo <yhu@odoo.com>2020-09-17 13:47:04 +0000
committeryhu-odoo <yhu@odoo.com>2020-10-02 09:31:09 +0000
commit83f2cac4b8ba101d6a7736a8ff408a3fdb5422fe (patch)
tree76262fc8bfd6fe8902fdca9f4b83b22fd335d37d /addons/purchase/static/src
parent170729ee58b199041d7545e7789ac9474e86f998 (diff)
[FIX] purchase: don't send preview email when PO not saved
When PO not saved, no mail can be send. Sending a reminder preview will get traceback. In this commit, we check if the PO is saved before sending the mail. Also clean some useless code in the send_reminder_preview() and fix the issue when no json object is return to the widget because of on mail send. Task 2339431 PR #57961 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
Diffstat (limited to 'addons/purchase/static/src')
-rw-r--r--addons/purchase/static/src/js/purchase_toaster_button.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/purchase/static/src/js/purchase_toaster_button.js b/addons/purchase/static/src/js/purchase_toaster_button.js
index 15820983c44..542858188dc 100644
--- a/addons/purchase/static/src/js/purchase_toaster_button.js
+++ b/addons/purchase/static/src/js/purchase_toaster_button.js
@@ -29,7 +29,9 @@ odoo.define('purchase.ToasterButton', function (require) {
model: this.model,
args: [[this.id]],
}).then(res => {
- this.do_notify(false, res.toast_message);
+ if (res) {
+ this.do_notify(false, res.toast_message);
+ }
})
},
});