Stop following the partner in Odoo 17 at creation time

62 Views Asked by At

Tips on how to stop following a partner when it is created using php and ripcord?

I tried this:

$models = ripcord::client($url.'/xmlrpc/2/object');
$vals = array(
    'name' => 'Test', 
    'mail_create_nosubscribe' => true 
);

$partner_id = $models->execute_kw($db, $uid, $password, 'res.partner', 'create', array($vals));

but it did not work.

1

There are 1 best solutions below

5
CZoellner On

I'll use the example from the official documentation:

$id = $models->execute_kw($db, $uid, $password, 'res.partner', 'create',
    array(array('name'=>"New Partner")));

The only expected argument for create is the set of values for creating a single record. These creation values should be formatted as a Python dictionary, and execute_kw anticipates Python arguments as a list. Consequently, an array of arrays is expected in PHP.

However, in certain methods, keyword arguments are also anticipated. To include or modify the context, you also can use keyword arguments in execute_kw. Odoo expects the context to be specified as a keyword, with a dictionary in Python or an array in PHP as its corresponding value.

$id = $models->execute_kw($db, $uid, $password, 'res.partner', 'create',
    array(array('name'=>"New Partner")),
    array('context'=>array('mail_create_nosubscribe'=>true)));