From 180f237907320488c67f7cc2e859e32687c6cc94 Mon Sep 17 00:00:00 2001 From: mgh-odoo Date: Mon, 10 Jun 2019 10:51:18 +0000 Subject: [PATCH] [FIX] stock, purchase_stock: activity type to exception When the system generate an activity the standard is to define it as an exception type. Todo works as well but we would keep it for the user and avoid a mix between exception from the system and created manually. Task-2007559 closes odoo/odoo#34006 Signed-off-by: Arnold Moyaux --- addons/purchase_stock/models/purchase.py | 2 +- addons/stock/models/stock_rule.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index 80f9e7d8339..572b5c0a8c2 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -304,7 +304,7 @@ class PurchaseOrderLine(models.Model): # If the quantity is now below the invoiced quantity, create an activity on the vendor bill # inviting the user to create a refund. activity = self.env['mail.activity'].sudo().create({ - 'activity_type_id': self.env.ref('mail.mail_activity_data_todo').id, + 'activity_type_id': self.env.ref('mail.mail_activity_data_warning').id, 'note': _('The quantities on your purchase order indicate less than billed. You should ask for a refund. '), 'res_id': line.invoice_lines[0].invoice_id.id, 'res_model_id': self.env.ref('account.model_account_move').id, diff --git a/addons/stock/models/stock_rule.py b/addons/stock/models/stock_rule.py index 76e0927c738..77893af9a81 100644 --- a/addons/stock/models/stock_rule.py +++ b/addons/stock/models/stock_rule.py @@ -289,9 +289,9 @@ class StockRule(models.Model): existing_activity = self.env['mail.activity'].search([('res_id', '=', product_id.product_tmpl_id.id), ('res_model_id', '=', self.env.ref('product.model_product_template').id), ('note', '=', note)]) if not existing_activity: - # If the user deleted todo activity type. + # If the user deleted warning activity type. try: - activity_type_id = self.env.ref('mail.mail_activity_data_todo').id + activity_type_id = self.env.ref('mail.mail_activity_data_warning').id except: activity_type_id = False self.env['mail.activity'].create({