Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected singleton error on create(vals) where vals is list of dicts fails #56

Open
mohamedhagag opened this issue Aug 19, 2020 · 2 comments

Comments

@mohamedhagag
Copy link

create accepts list of dicts and should create multiple records.

when trying so in odoorpc I get this error:

odoorpc/odoo.py in json(self, url, params)
    281         data = self._connector.proxy_json(url, params)
    282         if data.get('error'):
--> 283             raise error.RPCError(
    284                 data['error']['data']['message'],
    285                 data['error'])

RPCError: Error while validating constraint

**Expected singleton**: res.partner(2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2840, 2841, 2842, 2843, 2844, 2845, 2846, 2847, 2848, 2849, 2850, 2851, 2852, 2853, 2854, 2855, 2856, 2857, 2858, 2859, 2860, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, 2870, 2871, 2872, 2873, 2874, 2875, 2876, 2877, 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907, 2908, 2909, 2910, 2911, 2912)
None

Code is:

import odoorpc
odoo = odoorpc.ODOO('localhost', port=8012)
odoo.login('test', 'admin', 'admin')
vals = []
for i in range(200100,200199): 
    vals.append({ 
    'name': f'partner {i}', 
    'phone': f'+12345000{i}', 
    }) 

p = odoo.env['res.partner']
p.create(vals)
@mohamedhagag
Copy link
Author

This happens with odoo v12 but v13 working as expected !!

@sebalix
Copy link
Collaborator

sebalix commented Aug 21, 2020

It needs to be fixed yes, this syntax is not yet supported. Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants