base_jsonify: restore travis configuration (#112)
* [ADD] restore travis configuration * [PEP] fix pep8 * [REF] exclude product_categ_available_pos of testing due to issue https://github.com/odoo/odoo/pull/23749pull/2418/head
parent
52d508ed9b
commit
a633bcf6e9
|
@ -4,4 +4,4 @@
|
||||||
<field name="name">Partner Export</field>
|
<field name="name">Partner Export</field>
|
||||||
<field name="resource">res.partner</field>
|
<field name="resource">res.partner</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -12,8 +12,8 @@ class IrExportsLine(models.Model):
|
||||||
|
|
||||||
alias = fields.Char(
|
alias = fields.Char(
|
||||||
'Alias',
|
'Alias',
|
||||||
help=_('The complete path to the field where you can specify an '
|
help='The complete path to the field where you can specify an '
|
||||||
'alias on the a step as field:alias')
|
'alias on the a step as field:alias'
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.constrains('alias', 'name')
|
@api.constrains('alias', 'name')
|
||||||
|
|
|
@ -24,7 +24,6 @@ class Base(models.AbstractModel):
|
||||||
field_name, json_key = field_name.split(':')
|
field_name, json_key = field_name.split(':')
|
||||||
return field_name, json_key, subparser
|
return field_name, json_key, subparser
|
||||||
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def jsonify(self, parser):
|
def jsonify(self, parser):
|
||||||
""" Convert the record according to the parser given
|
""" Convert the record according to the parser given
|
||||||
|
@ -41,8 +40,8 @@ class Base(models.AbstractModel):
|
||||||
return a list of object even if there is only one element in input
|
return a list of object even if there is only one element in input
|
||||||
|
|
||||||
By default the key into the json is the name of the field extracted
|
By default the key into the json is the name of the field extracted
|
||||||
from the model. If you need to specify an alternate name to use as key, you
|
from the model. If you need to specify an alternate name to use as
|
||||||
can define your mapping as follow into the parser definition:
|
key, you can define your mapping as follow into the parser definition:
|
||||||
|
|
||||||
parser = [
|
parser = [
|
||||||
'field_name:json_key'
|
'field_name:json_key'
|
||||||
|
@ -61,7 +60,8 @@ class Base(models.AbstractModel):
|
||||||
res[json_key] = rec[field_name].jsonify(subparser)
|
res[json_key] = rec[field_name].jsonify(subparser)
|
||||||
elif field_type in ('many2one', 'reference'):
|
elif field_type in ('many2one', 'reference'):
|
||||||
if rec[field_name]:
|
if rec[field_name]:
|
||||||
res[json_key] = rec[field_name].jsonify(subparser)[0]
|
res[json_key] =\
|
||||||
|
rec[field_name].jsonify(subparser)[0]
|
||||||
else:
|
else:
|
||||||
res[json_key] = None
|
res[json_key] = None
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -57,7 +57,7 @@ class TestParser(TransactionCase):
|
||||||
partner = self.env['res.partner'].create({
|
partner = self.env['res.partner'].create({
|
||||||
'name': 'Akretion',
|
'name': 'Akretion',
|
||||||
'country_id': self.env.ref('base.fr').id,
|
'country_id': self.env.ref('base.fr').id,
|
||||||
'lang': 'en_US', # default
|
'lang': 'en_US', # default
|
||||||
'category_id': [(0, 0, {'name': 'Inovator'})],
|
'category_id': [(0, 0, {'name': 'Inovator'})],
|
||||||
'child_ids': [
|
'child_ids': [
|
||||||
(0, 0, {
|
(0, 0, {
|
||||||
|
|
Loading…
Reference in New Issue