コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3556 ビュー

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