콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
3557 화면

Hello guys,

I'd like to add an automated internal note via API in the Manufacturing Orders, but can't figure out how to reference it. the mrp.production doesn't seem to be able to do it, and trying stuff with mail.activity brought me nowhere further. :/ 


So, is there anyway to add an internal note to an existing Manufacturing Order using XML-RPC?(Example: https://ibb.co/XkHwfR9)


Thank you in advance!


아바타
취소
베스트 답변

Hi, 
in order to achieve that, you need to call the method message_post from mail_thread model  with messag_type='comment'.

Hope this helps.

아바타
취소
작성자

Can you give me an example for this with the test order? I can't seem to figure the correct parameters out :/

Hi,

Let's assume for example if a task is created from sale order line, you need to display a message in chatter of your sale order ok ?

Then in create method of sale.order.line:

@api.model_create_multi

def create(self, vals_list):

lines = super(SaleOrderLine, self).create(vals_list)

for line in lines:

if line.state == 'sale' and not line.is_expense:

line.sudo()._timesheet_service_generation()

# if the SO line created a task, post a message on the order

if line.task_id:

msg_body = _("Task Created (%s): <a href=# data-oe-model=project.task data-oe-id=%d>%s</a>") % (line.product_id.name, line.task_id.id, line.task_id.name)

line.order_id.message_post(body=msg_body, message_type='comment')

return lines