[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
mgh-odoo
2019-07-10 11:36:30 +00:00
committed by Arnold Moyaux
parent 671c71d7d8
commit 180f237907
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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,
+2 -2
View File
@@ -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({