Spare part integration

2 years ago

juancruzmartino

Code

use Odoo;
$odoo = Odoo::connect();

//Get spare parts unit_price price


$data = [
    'name' => '/',
    'location_id' => 85,
    'company_id' => 5,
    'product_id' => 13,
	'lot_id' => 821,
    'product_qty' => 1,
    'product_uom' => 1,
	'operations'  => [
		[
			0,
			'virtual_something',
			[
				'company_id' => 5,
				'product_id' => 55,
				'location_dest_id'=> 82, //destination warehouse (config)
				'location_id'=> 85, //warehouse
				'product_uom'=> 1,
				'product_uom_qty'=> 1,
				'type'=> "add",
				'lot_id' => false,
				'price_unit' => 0,
				'name' => "Spare part"
            ],
        ],
		[
			0,
			'virtual_something',
			[
				'company_id' => 5,
				'product_id' => 55,
				'location_dest_id'=> 82,
				'location_id'=> 85,
				'product_uom'=> 1,
				'product_uom_qty'=> 1,
				'type'=> "add",
				'lot_id' => false,
				'price_unit' => 0,
				'name' => "Spare part"
            ],

        ],
		[
			0,
			'virtual_something',
			[
				'company_id' => 5,
				'product_id' => 55,
				'location_dest_id'=> 82,
				'location_id'=> 85,
				'product_uom'=> 1,
				'product_uom_qty'=> 1,
				'type'=> "add",
				'lot_id' => false,
				'price_unit' => 0,
				'name' => "Spare part"
            ],

        ],
    ]
];

$id = $odoo->create('repair.order', $data);


$result = $odoo->call('repair.order', 'action_validate', [[ $id ]]);

//Check if $result needs a validation

//If it needs a validations

$validationData = [
'repair_id' => $id,
"product_id" => 55,
"location_id"=> 85,
"quantity"=> 1,
"product_uom_name"=> "Units"
];

$resultValidation = $odoo->create('stock.warn.insufficient.qty.repair', $validationData);
$result = $odoo->call('stock.warn.insufficient.qty.repair', 'action_done', [[ $resultValidation ]]);

ray($result);

//end if it needs a validation



$result = $odoo->call('repair.order', 'action_repair_start', [[ $id ]]);

ray($result);

$result = $odoo->call('repair.order', 'action_repair_end', [[ $id ]]);

ray($result);

Output

PHP Error:  Wrong parameters for Ripcord_RemoteException([string $message [, long $code [, Throwable $previous = NULL]]]) in /var/www/gitlab/gethenryco/subscription/subscription-api/vendor/edujugon/laradoo/src/ripcord/ripcord_client.php on line 234
HELO: Local email testing for your desktop!