Skip to Content
Menu
This question has been flagged

Hi,


I'm new to Odoo development and am trying to setup Odoo Project. In my process, I need to connect a task's kanban_state from project A to the kanban_state of another task in project B. The change is also stage dependent.

The logic goes like this: When task a in project A is on stage 3, I want task b in Project B on stage 4 to turn green. 

The two tasks originate from the sale order and I have created a field called x_studio_sales_order, that shows the sales Order number in both tasks.

I wrote a python script, but nothing is happening. Can you help me with this code?

Thanks a lot in advance!!


if True:
# Retrieve SO-ID
​ori_so_id = record['x_studio_sales_order']

# All Tasks search
​all_tasks = env['project.task'].search([('project.id.name', '=', 'B')])

# Filter S0-ID-Tasks:
​tasks_from_sales = all_tasks.filtered(lambda so: so.x_studio_sales_order == ori_so_id)

# Apply on Stage:
​if tasks_from_sales:
​​stage_id = record['stage_id.sequence']
if stage_id == 4:
​​record['kanban_state'] = 'done'
else:
​​​record['kanban_state'] = 'blocked'




Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
jún 23
2123
1
máj 25
327
0
apr 25
298
2
apr 24
1664
2
dec 23
2138