提交 57e046b3 authored 作者: 刘擎阳's avatar 刘擎阳

1.邮件操作修改为public user

上级 75283767
......@@ -946,6 +946,7 @@ class CcBL(models.Model):
return False
def mail_auto_push(self, mail_time):
self = self.with_context(dict(self._context, is_mail=True))
for item in self:
try:
utc_time = datetime.strptime(mail_time, "%Y-%m-%d %H:%M:%S")
......
......@@ -115,13 +115,17 @@ class CcShipPackageSyncLog(models.Model):
# 添加一个新增日志的方法,传入小包ID,API客户,操作状态,操作备注,操作时间
@api.model
def create_sync_log(self, package_id, api_customer, process_code, operate_remark, operate_time):
return self.create({
vals = {
'package_id': package_id,
'api_customer': api_customer,
'process_code': process_code,
'operate_remark': operate_remark,
'operate_time': operate_time
})
}
if self._context.get('is_mail'):
public_user = self.env.ref('base.public_user')
vals['operate_user'] = public_user.id
return self.create(vals)
# 继承小包对象,并重载action_sync方法, 增加is_sync字段
......
......@@ -150,7 +150,15 @@ class BatchInputShipPackageStatusWizard(models.TransientModel):
# if self.bl_id.state == 'draft' and self.bl_id.ship_package_ids.filtered(
# lambda line: line.state.tk_code == 'cb_imcustoms_start'):
# self.bl_id.ccing_func()
public_user = self.env.ref('base.public_user')
for bl_obj in bl_objs:
# print(self._context)
if self._context.get('is_mail'):
bl_obj.message_post(body=_('[%s]%sUpdate to[%s]%s') % (
self.current_status.tk_code or '', self.current_status.name or '', self.update_status.tk_code or '',
self.update_status.name or ''), author_id=public_user.id,
email_from=public_user.display_name)
else:
bl_obj.message_post(body=_('[%s]%sUpdate to[%s]%s') % (
self.current_status.tk_code or '', self.current_status.name or '', self.update_status.tk_code or '',
self.update_status.name or ''))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论