Skip to content

terrakernel/ODXProxyClient-PHP-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ODX PHP POINT OF SALE

A streamlined, web-based POS system built with PHP and JavaScript, designed to interface seamlessly with Odoo via the ODX Proxy.

QUICK START

  1. Clone the Project Open your terminal and run: git clone https://github.com/your-username/odx-php-pos.git cd odx-php-pos

  2. Install Dependencies (Composer) This project uses Composer to manage Odoo communication libraries. Run: composer install

  3. Configuration Create a config.php file in the root directory. This file is ignored by Git for security. PHP Example:

  1. Run the Project Start a local PHP development server: php -S localhost:8000 Visit http://localhost:8000 in your browser.

ODOO INTEGRATION REFERENCE

The system interacts with Odoo models using four primary methods. Here is how to use them within your PHP logic:

SEARCHREAD (FETCH DATA) Used to find records and return specific fields. $domain = [['available_in_pos', '=', true]]; $fields = ['id', 'name', 'list_price']; $products = Odx::searchRead('product.product', $domain, $fields);

CREATE (INSERT DATA) Used to create new records. Returns the ID of the new record. $data = [ 'session_id' => 12, 'amount_total' => 150.00, 'lines' => [ [0, 0, [ 'product_id' => 5, 'qty' => 2, 'price_unit' => 75.00, 'price_subtotal' => 150.00, 'price_subtotal_incl' => 150.00 ]] ], 'payment_ids' => [ [0, 0, ['amount' => 150.00, 'payment_method_id' => 1]] ] ]; $newOrderId = Odx::create('pos.order', $data);

WRITE (UPDATE DATA) Used to update existing records. Requires an array of IDs. $ids = [123]; $update = ['name' => 'Updated Product Name']; $success = Odx::write('product.product', $ids, $update);

CALL (EXECUTE LOGIC) Used to trigger Odoo "buttons" or backend methods. $sessionId = 12; $result = Odx::call('pos.session', 'action_pos_session_closing_control', [$sessionId]);

PROJECT STRUCTURE

index.php: The Frontend (HTML/Bootstrap/JavaScript).

api.php: The Backend Router (handles AJAX requests and Odoo Logic).

config.php: Private credentials (API keys and URLs).

.gitignore: Prevents sensitive files from being pushed to GitHub.

vendor/: Auto-generated folder containing PHP libraries.

SECURITY REQUIREMENTS

IMPORTANT: Never commit config.php. This file contains your Odoo secrets. Ensure your .gitignore includes config.php.

SSL/HTTPS: Always use HTTPS when deploying the ODX Proxy to ensure data between PHP and Odoo is encrypted.

About

PHP Demo of ODXProxy

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors