PHP code example of sefirosweb / laravel-odoo-connector
1. Go to this page and download the library: Download sefirosweb/laravel-odoo-connector library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sefirosweb / laravel-odoo-connector example snippets
$saleOrder = SaleOrder::find(1);
$saleOrder->action('action_confirm');
// Triggers the "Confirm" button on sale.order — see Odoo's sale/models/sale_order.py
namespace App\Odoo;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Sefirosweb\LaravelOdooConnector\Http\Models\ProductProduct as BaseProductProduct;
class CustomProductProduct extends BaseProductProduct
{
protected $table = 'product.product';
public function our_custom_belongs(): BelongsTo
{
return $this->belongsTo(OurCustomModel::class, 'our_field_id');
}
}
use Sefirosweb\LaravelOdooConnector\Http\Models\OdooModel;
use Sefirosweb\LaravelOdooConnector\Http\Traits\SoftDeleteOdoo;
class MyModel extends OdooModel
{
use SoftDeleteOdoo;
// ...
}
$products = ProductProduct::get_all('id', 'name', 100);
// Behaves like ::all() but paginates under the hood.