İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
6132 Görünümler

I am trying to create a new customer contact within Studio's automated action with the following python code..

env['res.partner'].create({'name':'Ba bu', 'property_account_payable_id':env['account.account'].search([('code', '=', '200010')]).id, 'property_account_receivable_id':env['account.account'].search([('code', '=', '100010')]).id})

It is throwing the following error...

File "/home/odoo/src/odoo/12.0/odoo/api.py", line 452, in _model_create_multi

return create(self, arg)

File "/home/odoo/src/odoo/12.0/odoo/models.py", line 3560, in create

records = self._create(data_list)

File "/home/odoo/src/odoo/12.0/odoo/models.py", line 3646, in _create

col_val = field.convert_to_column(val, self, stored)

File "/home/odoo/src/odoo/12.0/odoo/fields.py", line 1954, in convert_to_column

value = self.convert_to_cache(value, record)

File "/home/odoo/src/odoo/12.0/odoo/fields.py", line 1966, in convert_to_cache

raise ValueError("Wrong value for %s: %r" % (self, value))

ValueError: <class 'ValueError'>: "Wrong value for res.partner.type: 'opportunity'" while evaluating

"#record.write({'x_studio_debug' : time.time()})\n#record.write({'x_studio_debug' : env['res.partner'].search_count([('email', '=', 'boonboh@gmail.com')])})\n#record.write({'x_studio_debug' : env['account.account'].search([('code', '=', '100010')]).id})\n\n\nif env['res.partner'].search_count([('email', '=', 'babu@gmail.com')]) > 0: \n target = env['res.partner'].search([('email', '=', 'babu@gmail.com')])[0]\n record.write({'x_studio_debug' : target.name})\n record.write({'partner_id' : target.id})\nelse:\n env['res.partner'].create({'name':'Ba bu', 'property_account_payable_id':env['account.account'].search([('code', '=', '200010')]).id, 'property_account_receivable_id':env['account.account'].search([('code', '=', '100010')]).id})"

Any idea?

Thanks


Avatar
Vazgeç

Contact created... Thanks!!

En İyi Yanıt

res.partner.type should be "Contact" or "Private Address".

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Şub 21
4436
3
Haz 20
5156
0
Haz 20
2710
0
Şub 16
3795
0
Ağu 23
3457