Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
4171 Vizualizări

I am tryin to use this module https://apps.odoo.com/apps/modules/12.0/partner_fax/

Module is installed, I can see in res.partner added field Fax. I can add/edit field Fax in Odoo. So far so good. 

But when I try to create record with script and create function I got this error

ValueError: Invalid field 'fax' on model 'res.partner'

My code looks like this:

#!/usr/bin/python3 

from __future__ import print_function
from odoo.api import Environment
import odoo
import csv

def connect(dbname='Test', uid=1, context=None):
r = odoo.registry(dbname)
cr = r.cursor()
Environment.reset()
env = Environment(cr, uid, context or {})
print('Connected to %s with user %s %s'
% (dbname, env.uid, env.user.name))
return env

env = connect('odoo13')

env['res.partner'].create({
'name': 'Test 123',
'fax':'99999',
}
)
env.cr.commit()


Importand part of module:

https://github.com/OCA/partner-contact/blob/13.0/partner_fax/views/res_partner.xml

https://github.com/OCA/partner-contact/blob/13.0/partner_fax/models/res_partner.py




Imagine profil
Abandonează
Autor Cel mai bun răspuns

I tested on both. 

Error on odoo12 - res.partner.create() with unknown fields: fax

Error on odoo13 - ValueError: Invalid field 'fax' on model 'res.partner'

In both cases column in database exists. 


Imagine profil
Abandonează
Autor

I found that create() work without problem when I use shell.

This mean problem is somewhere here

def connect(dbname='Test', uid=1, context=None):

r = odoo.registry(dbname)

cr = r.cursor()

Environment.reset()

env = Environment(cr, uid, context or {})

print('Connected to %s with user %s %s'

% (dbname, env.uid, env.user.name))

return env

odoo/services/db.py has env defined like this

env = odoo.api.Environment(cr, SUPERUSER_ID, {})

any idea what am I missing ?

Cel mai bun răspuns

The module link provided by you is for 12.0 whereas your app seems to be 13.0. Try installing the 13.0 release of the module and see if that takes care of it.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
feb. 20
3136
3
iun. 25
995
0
ian. 25
730
1
nov. 23
2245
2
mai 17
9485