Hey there! Back for more? Good!
Welcome to the "Using Cenit's Twitter Integration" screencast.
This tutorial shows how to post a Tweet whenever you create a new product on your Odoo system. It assumes you have already installed Cenit's Twitter Integration addon correctly.
Well then, let's get our hands dirty (or our fingertips at least), go to the Cenit Integration tab on your top menu.
By default it opens on the Schemas view, so go ahead and select the Twitter Tweet.json schema.
As you can see it has only 2 properties: a tweet id and a status.
The tweet id is pretty much for Twitter internal mechanisms, so we won't be worrying about it.
Now check the status property, it is a simple string, without any restrictions in format.
Ok then, let's create a DataType to map our Odoo products as tweets.
Click on Data types and then on the Create button on the top.
Choose a name for your data type, something like ProductTweet for instance.
For the model select the "Product Template", which is the one that holds generic information regarding a product.
Select the Twitter library and then the Tweet.json schema.
And now to the Mappings! As we only will be mapping one property this will be really fast. Click the "Add an item"
On the Cenit cell type "status", that is the name of the property in the schema.
On the Type cell you'll see 4 options, in this case you could use either Field or Default, as the status will not be a relation with other model on Odoo.
If you choose Field then the value on the Odoo cell must be the name of a field within the "Product Template" model, something like "name".
This would mean that our automatic tweets would consist solely of the name of the product that triggered the Tweet posting, that's not really cool, so let's do something better.
Select the Default option on the Type cell.
Now we can use a string template substituting values from the Odoo model. Let's say something like...
Save the Data Type and let's try it.
If you don't have it yet you should install the "Sales Management" addon. Click on the Sales tab in the top menu.
Go to Products and create a new one. Don't trouble yourself right now with much details, we'll only need the name, so pick up a really cool name and type it into the box.
Save the product and... check your Twitter status.
Well, that's all folks! See you around.
Back to blog Get in touch