[IMP] website_twitter: Add a tutorial for the credentials configuration
This commit is contained in:
@@ -34,12 +34,12 @@ class ResConfigSettings(models.TransientModel):
|
||||
related='website_id.twitter_api_secret',
|
||||
string='API secret',
|
||||
help='Twitter API secret you can get it from https://apps.twitter.com/')
|
||||
twitter_tutorial = fields.Boolean(string='Show me how to obtain the Twitter API Key and Secret')
|
||||
twitter_screen_name = fields.Char(
|
||||
related='website_id.twitter_screen_name',
|
||||
string='Favorites From',
|
||||
help='Screen Name of the Twitter Account from which you want to load favorites.'
|
||||
'It does not have to match the API Key/Secret.')
|
||||
twitter_server_uri = fields.Char(string='Twitter server uri', readonly=True)
|
||||
|
||||
def _get_twitter_exception_message(self, error_code):
|
||||
if error_code in TWITTER_EXCEPTION:
|
||||
@@ -74,3 +74,12 @@ class ResConfigSettings(models.TransientModel):
|
||||
if vals.get('twitter_api_key') or vals.get('twitter_api_secret') or vals.get('twitter_screen_name'):
|
||||
self._check_twitter_authorization()
|
||||
return TwitterConfig
|
||||
|
||||
@api.model
|
||||
def get_values(self):
|
||||
res = super(ResConfigSettings, self).get_values()
|
||||
Params = self.env['ir.config_parameter'].sudo()
|
||||
res.update({
|
||||
'twitter_server_uri': '%s/' % Params.get_param('web.base.url', default='http://yourcompany.odoo.com'),
|
||||
})
|
||||
return res
|
||||
|
||||
@@ -21,15 +21,35 @@
|
||||
<label class="col-lg-3 o_light_label" string="API secret" for="twitter_api_secret"/>
|
||||
<field name="twitter_api_secret" class="oe_inline"/>
|
||||
</div>
|
||||
<a data-toggle="collapse" class="fa fa-arrow-right" href="#" data-target="#twitter_tutorial" aria-label="Twitter tutorial">
|
||||
Show me how to obtain the Twitter API key and Twitter API secret
|
||||
</a>
|
||||
<div class="row mt16 collapse" id="twitter_tutorial">
|
||||
<blockquote class="small">
|
||||
<h2>How to configure the Twitter API access</h2>
|
||||
<ol>
|
||||
<li>Create a new Twitter application on <a href="https://apps.twitter.com/app/new" target="new">https://apps.twitter.com/app/new</a>
|
||||
with the following values:
|
||||
<ul>
|
||||
<li><strong>Name: </strong> Odoo Twitter Integration</li>
|
||||
<li><strong>Description: </strong> Odoo Twitter Integration </li>
|
||||
<li><strong>Website: </strong>
|
||||
<b><field name="twitter_server_uri" /></b></li>
|
||||
<li><strong>Callback URL: </strong>Leave blank</li>
|
||||
<li>Accept terms of use and click on the Create your Twitter application button at the bottom</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Switch to the API Keys tab: <br/>
|
||||
<img src='/website_twitter/static/src/img/api_key.png' alt="api_key.png"/>
|
||||
</li><br/>
|
||||
<li>Copy/Paste Consumer Key (API Key) and Consumer Secret (API Secret) keys below.</li>
|
||||
</ol>
|
||||
</blockquote>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="col-lg-3 o_light_label" string="Favorites From" for="twitter_screen_name"/>
|
||||
<field name="twitter_screen_name" class="oe_inline"/>
|
||||
</div>
|
||||
<div>
|
||||
<a data-toggle="modal" class="fa fa-arrow-right" href="#" data-target="#twitter_tutorial" aria-label="Twitter tutorial">
|
||||
Tutorial
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user