minor fix
This commit is contained in:
parent
fb7adc9546
commit
d4598d31e4
|
@ -2,6 +2,7 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
import simplejson as json
|
||||
from trytond.pool import Pool
|
||||
|
||||
STATES = {'readonly': True}
|
||||
|
||||
|
@ -16,6 +17,7 @@ class ApiLog(ModelSQL, ModelView):
|
|||
msg_response = fields.Char('Msg Response', states=STATES)
|
||||
request_json = fields.Text("Request Json", states=STATES)
|
||||
headers_json = fields.Text("Header Json", states=STATES)
|
||||
file_json = fields.Binary("File Json", states=STATES)
|
||||
status = fields.Char('Status', states=STATES)
|
||||
|
||||
@classmethod
|
||||
|
@ -29,5 +31,9 @@ class ApiLog(ModelSQL, ModelView):
|
|||
('status', '=', 'pending')
|
||||
], limit=10)
|
||||
for log in logs:
|
||||
res = log.channel.request_api(json.loads(log.request_json))
|
||||
data = log.file_json.decode("utf-8")
|
||||
res = {}
|
||||
if log.channel.channel_name == 'mercadolibre':
|
||||
MercadoLibre = Pool().get('sale.web_channel.mercado_libre')
|
||||
res = MercadoLibre.request_api(json.loads(data))
|
||||
cls.write([log], res)
|
||||
|
|
|
@ -425,6 +425,7 @@ class MercadoLibre(SaleWebChannel):
|
|||
@classmethod
|
||||
def request_api(cls, data):
|
||||
channel = cls._get_channel()
|
||||
print('ingresa por aca')
|
||||
response = {'status': 'error', 'msg_response': 'Fail in process !!!'}
|
||||
if not channel:
|
||||
return response
|
||||
|
|
|
@ -12,6 +12,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="msg_response"/>
|
||||
<label name="status"/>
|
||||
<field name="status"/>
|
||||
<label name="file_json"/>
|
||||
<field name="file_json"/>
|
||||
<newline />
|
||||
<separator string="Header" id="headers_json" colspan="4"/>
|
||||
<field name="headers_json" colspan="4" yexpand="0" width="25"/>
|
||||
|
|
Loading…
Reference in New Issue