From 38c177881890961e69475cce159e537f99cd2afb Mon Sep 17 00:00:00 2001 From: ThomasNucleus Date: Wed, 4 Apr 2018 09:55:37 +1000 Subject: [PATCH] Fix write function implementation https://www.odoo.com/documentation/10.0/api_integration.html $models->execute_kw($db, $uid, $password, 'res.partner', 'write', array(array($id), array('name'=>"Newer partner"))); Passing an array of ids was causing a web call failure due to the $id variable being stored in an array --- src/Client.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index fb9c485..29adc80 100644 --- a/src/Client.php +++ b/src/Client.php @@ -225,12 +225,12 @@ public function create($model, $data) * Update model(s) * * @param string $model Model - * @param array $id Model id to update + * @param array $ids Model ids to update * @param array $fields A associative array (format: ['field' => 'value']) * * @return array */ - public function write($model, $id, $fields) + public function write($model, $ids, $fields) { $response = $this->getClient('object')->execute_kw( $this->database, @@ -239,7 +239,7 @@ public function write($model, $id, $fields) $model, 'write', [ - [$id], + $ids, $fields ] );