Přejít na obsah
Menu
You need to be registered to interact with the community.
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šit
Related Posts Odpovědi Zobrazení Aktivita
1
čvn 23
2690
1
kvě 25
706
0
dub 25
679
2
dub 24
2204
2
pro 23
2531