minor fix refresh token
This commit is contained in:
parent
4d8629082e
commit
a032f9cb65
|
@ -64,6 +64,9 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
|
|||
icon="tryton-ok"/>
|
||||
<button name="finished" string="Finished"
|
||||
icon="tryton-forward"/>
|
||||
<button name="refresh_token" string="Finished"
|
||||
icon="tryton-ok"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
|
|
|
@ -144,6 +144,9 @@ class SaleWebChannel(Workflow, ModelSQL, ModelView):
|
|||
'finished': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
'refresh_token': {
|
||||
'invisible': Eval('channel_name') != 'shopify',
|
||||
},
|
||||
})
|
||||
|
||||
@staticmethod
|
||||
|
@ -176,6 +179,19 @@ class SaleWebChannel(Workflow, ModelSQL, ModelView):
|
|||
def finished(cls, records):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
def refresh_token(cls, records):
|
||||
if records:
|
||||
for record in records:
|
||||
if record.channel_name == 'mercadolibre':
|
||||
MercadoLibre = Pool().get('sale.web_channel.mercado_libre')
|
||||
channels = MercadoLibre.search([
|
||||
('state', '=', 'active'),
|
||||
('channel_name', '=', 'mercadolibre'),
|
||||
])
|
||||
channels[0]._validate_token()
|
||||
|
||||
def send_mail_notification(self, message):
|
||||
Template = Pool().get('email.template')
|
||||
setattr(self, 'message', message)
|
||||
|
|
Loading…
Reference in New Issue