Workflows can be moved along by sending them signals. Instead of using the top-level execute_kw, signals are sent using exec_workflow.
For example code is like below.
client = models.execute_kw(
db, uid, password,
'res.partner', 'search_read',
[[('customer', '=', True)]],
{'limit': 1, 'fields': [
'property_account_receivable',
'property_payment_term',
'property_account_position']
})[0]
invoice_id = models.execute_kw(
db, uid, password,
'account.invoice', 'create', [{
'partner_id': client['id'],
'account_id': client['property_account_receivable'][0],
'invoice_line': [(0, False, {'name': "AAA"})]
}])
models.exec_workflow(
db, uid, password, 'account.invoice', 'invoice_open', invoice_id)
Note- Signals are sent to a specific record, and possibly trigger a transition on the workflow instance associated with the record.
0 Comment(s)