Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1857 Переглядів

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'




Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 23
2724
1
трав. 25
731
0
квіт. 25
718
2
квіт. 24
2260
2
груд. 23
2580