11import logging
22
3- from odoo import SUPERUSER_ID , _ , fields , models
3+ from odoo import _ , models
44from odoo .exceptions import UserError
55
66_logger = logging .getLogger (__name__ )
@@ -34,17 +34,8 @@ def create_returns(self):
3434 "counterpart in company {}: {}. This could not be automatically returned; "
3535 "please take care to do this manually."
3636 ).format (ic_pick .company_id .name , ic_pick .name , pick .name )
37- _logger .warning (note )
38- pick .activity_schedule (
39- "mail.mail_activity_data_todo" ,
40- fields .Date .today (),
41- note = note ,
42- # Try to notify someone relevant
43- user_id = (
44- pick .sale_id .user_id .id
45- or pick .sale_id .team_id .user_id .id
46- or SUPERUSER_ID ,
47- ),
37+ self ._notify_picking_problem (
38+ pick .sale_id .auto_purchase_order_id , additional_note = note
4839 )
4940 return res
5041
@@ -71,17 +62,8 @@ def create_returns(self):
7162 "counterpart in company {}: {}. This could not be automatically returned; "
7263 "please take care to do this manually."
7364 ).format (ic_pick .company_id .name , ic_pick .name , pick .name )
74- _logger .warning (note )
75- pick .activity_schedule (
76- "mail.mail_activity_data_todo" ,
77- fields .Date .today (),
78- note = note ,
79- # Try to notify someone relevant
80- user_id = (
81- pick .sale_id .user_id .id
82- or pick .sale_id .team_id .user_id .id
83- or SUPERUSER_ID ,
84- ),
65+ self ._notify_picking_problem (
66+ pick .sale_id .auto_purchase_order_id , additional_note = note
8567 )
8668 return res
8769
0 commit comments