minor fix refresh token

This commit is contained in:
wilson gomez 2021-08-23 15:47:20 -05:00
parent 4d8629082e
commit a032f9cb65
2 changed files with 19 additions and 0 deletions

View File

@ -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>

View File

@ -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)