Remove safe eval + pyflakes
This commit is contained in:
parent
5457093dee
commit
bb873a614f
13
api.py
13
api.py
|
@ -1,9 +1,8 @@
|
||||||
# This file is part of the carrier_send_shipments module for Tryton.
|
# This file is part of the carrier_send_shipments_seurvalencia module for Tryton.
|
||||||
# The COPYRIGHT file at the top level of this repository contains the full
|
# The COPYRIGHT file at the top level of this repository contains the full
|
||||||
# copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.model import fields
|
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
from trytond.pyson import Eval
|
from trytond.pyson import Eval, Not, Equal
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -30,6 +29,13 @@ class CarrierApi:
|
||||||
res.append(('seurvalencia', 'Seur Valencia'))
|
res.append(('seurvalencia', 'Seur Valencia'))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def view_attributes(cls):
|
||||||
|
return super(CarrierApi, cls).view_attributes() + [
|
||||||
|
('//page[@id="seurvalencia"]', 'state', {
|
||||||
|
'invisible': Not(Equal(Eval('method'), 'seurvalencia')),
|
||||||
|
})]
|
||||||
|
|
||||||
def test_seurvalencia(self, api):
|
def test_seurvalencia(self, api):
|
||||||
'''
|
'''
|
||||||
Test Seur Valencia connection
|
Test Seur Valencia connection
|
||||||
|
@ -37,7 +43,6 @@ class CarrierApi:
|
||||||
'''
|
'''
|
||||||
message = 'Connection unknown result'
|
message = 'Connection unknown result'
|
||||||
|
|
||||||
seurvalencia_context = {}
|
|
||||||
with API(api.username, api.password, api.debug) as seurvalencia_api:
|
with API(api.username, api.password, api.debug) as seurvalencia_api:
|
||||||
message = seurvalencia_api.test_connection()
|
message = seurvalencia_api.test_connection()
|
||||||
self.raise_user_error(message)
|
self.raise_user_error(message)
|
||||||
|
|
|
@ -4,7 +4,7 @@ The COPYRIGHT file at the top level of this repository contains the full
|
||||||
copyright notices and license terms. -->
|
copyright notices and license terms. -->
|
||||||
<data>
|
<data>
|
||||||
<xpath expr="/form/notebook/page[@id='api']" position="after">
|
<xpath expr="/form/notebook/page[@id='api']" position="after">
|
||||||
<page string="Seur" id="seur" states="{'invisible': Not(Equal(Eval('method'), 'seurvalencia'))}">
|
<page string="Seur Valencia" id="seurvalencia">
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue