Skip to Content
Menu
This question has been flagged
1 Reply
2054 Views

Hi, 

I need to add a new field in sale.rental.schedule module because I want to group by a custom field that I have in the Sales Order.


I added the field as follow:

Related Field: order_id.my_field


Then I tried to group by "my_field" and I got the following error:


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
psycopg2.errors.UndefinedColumn: column sale_rental_schedule.my_field does not exist
LINE 1: ...sale_rental_schedule"."card_name" as "card_name", "sale_rent...




Thanks for your help!

Avatar
Discard
Best Answer

Hi Yeison,

You have to write store=True in py file where you have added field. Like this,

my_field = fields.field_type(related='order_id.my_field', store=True, string=string

Avatar
Discard
Author

Hi, thanks for your reply.

I created a new field directly in Odoo and this new field has the store option already selected.

Please, see the following video:

https://drive.google.com/file/d/1waCEyxOBaZM46IZENcgTTRJvlfGpW1Li/view?usp=sharing

Thanks

Hello Yeison X,

I hope you have x_studio_paciente field in comodel of order_id field.

And make sure you aresing same field type in x_new_filed. As per your video, you are using integer type for x_new_filed and x_studio_paciente field type is many2one.

Author

Hi Heamangi, thanks for your reply.

I Created the field again and I was careful that it was the same field type Many2one.

I get the following error:

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch

result = request.dispatch()

File "/home/odoo/src/odoo/odoo/http.py", line 683, in dispatch

result = self._call_function(**self.params)

File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function

return checked_call(self.db, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper

return f(dbname, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/http.py", line 347, in checked_call

result = self.endpoint(*a, **kw)

File "/home/odoo/src/odoo/odoo/http.py", line 912, in __call__

return self.method(*args, **kw)

File "/home/odoo/src/odoo/odoo/http.py", line 531, in response_wrap

response = f(*args, **kw)

File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1347, in search_read

return self.do_search_read(model, fields, offset, limit, domain, sort)

File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1366, in do_search_read

return Model.web_search_read(domain, fields, offset=offset, limit=limit, order=sort)

File "/home/odoo/src/odoo/addons/web/models/models.py", line 53, in web_search_read

records = self.search_read(domain, fields, offset=offset, limit=limit, order=order)

File "/home/odoo/src/odoo/odoo/models.py", line 4839, in search_read

result = records.read(fields)

File "/home/odoo/src/odoo/odoo/models.py", line 3018, in read

self._read(stored_fields)

File "/home/odoo/src/odoo/odoo/models.py", line 3136, in _read

cr.execute(query_str, params + [sub_ids])

File "<decorator-gen-3>", line 2, in execute

File "/home/odoo/src/odoo/odoo/sql_db.py", line 101, in check

return f(self, *args, **kwargs)

File "/home/odoo/src/odoo/odoo/sql_db.py", line 298, in execute

res = self._obj.execute(query, params)

Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/home/odoo/src/odoo/odoo/http.py", line 639, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File "/home/odoo/src/odoo/odoo/http.py", line 315, in _handle_exception

raise exception.with_traceback(None) from new_cause

psycopg2.errors.UndefinedColumn: column sale_rental_schedule.x_paciente does not exist

LINE 1: ..."state", "sale_rental_schedule"."late" as "late", "sale_rent...

^

Hi Yeison,

If possible to check together on Hangout then send me an invitation on Gmail hangout.

Gmail address - rupareliyahemangi145@gmail.com

Or give me your skype ID.

Related Posts Replies Views Activity
0
Mar 21
1445
0
Jun 21
6
1
May 21
2478
1
Nov 24
1483
1
Nov 24
1190