Pular para o conteúdo
Menu
Esta pergunta foi sinalizada

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
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
1
jun. 23
2691
1
mai. 25
706
0
abr. 25
680
2
abr. 24
2206
2
dez. 23
2533