Last active
July 28, 2021 03:59
-
-
Save zachlankton/25b65e08764dbacfdb5bafcf0472a1b9 to your computer and use it in GitHub Desktop.
Odoo RFQ Form Integration Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: CUSTOM Odoo RFQ Integration | |
| Plugin URI: | |
| description: CUSTOM: Pushes data from the RFQ form into the Odoo CRM | |
| Version: 1.0 | |
| Author: Zach Lankton | |
| Author URI: | |
| License: GPL2 | |
| */ | |
| // Uncomment these 2 lines to see errors | |
| // error_reporting(E_ALL); | |
| // ini_set("display_errors", 1); | |
| // Setup Form Submission Vars | |
| $name = $_POST['customer_name']; | |
| $email = $_POST['email']; | |
| $phone = $_POST['phone']; | |
| $address = $POST['address']; | |
| // and any others required... etc... | |
| // Odoo Login Info | |
| $url = ""; | |
| $db = ""; | |
| $username = ""; | |
| $apikey = ""; | |
| require_once('ripcord/ripcord.php'); | |
| // Get Client | |
| $common = ripcord::client("$url/xmlrpc/2/common"); | |
| // Login using API Key | |
| $uid = $common->authenticate($db, $username, $apikey, array()); | |
| // Insert RFQ Customer Info into Odoo CRM | |
| $id = $models->execute_kw($db, $uid, $apikey, | |
| 'res.partner', 'create', | |
| array(array( | |
| 'type' => "customer", | |
| 'name' => $name, | |
| 'email' => $email, | |
| 'phone' => $phone, | |
| 'address' => $address | |
| // etc... | |
| // To view a model's fields you can go into | |
| // settings->technical->models to view all | |
| // the fields which are in the model. | |
| ))); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment