I am inheriting 'account.partner.ledger' module. When we select the customer we will be able to print the report of the customer's ledger. In the partner ledger menu I want to make 'include Initial Balances' checkbox checked by default if the filter is by date/period.I tried to override the method by my custom module but I am unable to solve the error which I am getting.
Code,
#api.multi
def onchange_filter(self,filter='filter_no', fiscalyear_id=False):
res = super(account_partner_ledger, self).onchange_filter(filter=filter, fiscalyear_id=fiscalyear_id)
if filter in ['filter_no', 'unreconciled']:
if filter == 'unreconciled':
res['value'].update({'fiscalyear_id': False})
res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False})
if filter in ['filter_date','filter_period']:
res['value'].update({'initial_balance': True, 'period_from': True, 'period_to': True, 'date_from': True ,'date_to': True})
return res
Error,
Traceback (most recent call last):
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 544, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 581, in dispatch
result = self._call_function(**self.params)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 317, in _call_function
return checked_call(self.db, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\service\model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 314, in checked_call
return self.endpoint(*a, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 810, in __call__
return self.method(*args, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\http.py", line 410, in response_wrap
response = f(*args, **kw)
File "C:\Users\zendynamix\odooGit\odoo8\addons\web\controllers\main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\addons\web\controllers\main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\api.py", line 399, in old_api
result = method(recs, *args, **kwargs)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5985, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5883, in _onchange_eval
self.update(self._convert_to_cache(method_res['value'], validate=False))
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5391, in _convert_to_cache
for name, value in values.iteritems()
File "C:\Users\zendynamix\odooGit\odoo8\openerp\models.py", line 5392, in <dictcomp>
if name in fields
File "C:\Users\zendynamix\odooGit\odoo8\openerp\fields.py", line 1250, in convert_to_cache
return self.to_string(value)
File "C:\Users\zendynamix\odooGit\odoo8\openerp\fields.py", line 1240, in to_string
return value.strftime(DATE_FORMAT) if value else False
AttributeError: 'bool' object has no attribute 'strftime'
You have to look at the underlying code sometimes to understand what's going on, you're getting errors because Odoo is trying to convert a boolean object back to a string representation of a time (it expects a python date object)
You can fire up a terminal and reproduce your error:
>>> True.strftime
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'bool' object has no attribute 'strftime'
>>>
This is the to_string method from odoo
#staticmethod
def to_string(value):
""" Convert a :class:`date` value into the format expected by the ORM. """
return value.strftime(DATE_FORMAT) if value else False
The test condition if value test's to see if value evaluates to False, testing from the terminal
>>> x = ''
>>> if x: print('Yeah')
...
>>>
>>> x = True
>>> if x: print('Yeah')
...
Yeah
>>> x = False
>>> if x: print('Yeah')
...
>>>
>>>
from the output, we can draw a conclusion that an empty string or False evaluates to False while a True value will evaluate to True, so instead of setting the date values to True, set all of them to empty strings.
#api.multi
def onchange_filter(self,filter='filter_no', fiscalyear_id=False):
res = super(account_partner_ledger, self).onchange_filter(filter=filter, fiscalyear_id=fiscalyear_id)
if filter in ['filter_no', 'unreconciled']:
if filter == 'unreconciled':
res['value'].update({'fiscalyear_id': False})
res['value'].update({'initial_balance': False, 'period_from': False, 'period_to': False, 'date_from': False ,'date_to': False})
if filter in ['filter_date','filter_period']:
res['value'].update({'initial_balance': 'True', 'period_from': '', 'period_to': '', 'date_from': '', 'date_to': ''})
return res
When you look at your code you'll see:
'date_from': True ,'date_to': True
This causes your error.
You should set those fields to a date not to a Boolean.
The value False is valid, since you should be able to not fill in a date.
Try using strptime instead of strftime and see if it solves the problem.
You can use strptime as follows for example:-
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
my_date = datetime.strptime(self.date_column, DEFAULT_SERVER_DATETIME_FORMAT)
Related
I want to get the product binding and show it in a view (this works). If it has no binding I have to check if that product is part of a bill of materials and if it is, I have to look for the binding of the parent and show that binding (this is what doesn't work, it doesn't give error but it doesn't assign the value of the parent to the child).
class ProductProduct(models.Model):
_inherit = 'product.product'
main_endado_bind = fields.Char(
string='Main Endado Bind',
store=True,
compute='_get_endado_bind'
)
#api.multi
#api.depends('endado_bind_ids', 'bom_ids.bom_line_ids')
def _get_endado_bind(self, external_id=''):
for product in self:
if product.endado_bind_ids:
parent_external_id = product.endado_bind_ids[0].external_id
product.main_endado_bind = parent_external_id
for line_product in product.bom_ids.bom_line_ids:
line_product.product_id._get_endado_bind(external_id=parent_external_id)
elif external_id:
product.main_endado_bind = external_id
When modifying a BOM I want to assign the binding id of the parent to the new material but it is the parent that triggers the compute as it is its BOM that is modified.
If instead of the last line I use a write I get this error:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/mnt/environment/odoo-server/odoo/fields.py", line 967, in __get__
value = record.env.cache.get(record, self)
File "/mnt/environment/odoo-server/odoo/api.py", line 1041, in get
value = self._data[key][field][record._ids[0]]
KeyError: 79
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/environment/odoo-server/odoo/http.py", line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/mnt/environment/odoo-server/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/mnt/environment/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/mnt/environment/odoo-server/odoo/http.py", line 695, in dispatch
result = self._call_function(**self.params)
File "/mnt/environment/odoo-server/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/mnt/environment/odoo-server/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/mnt/environment/odoo-server/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/mnt/environment/odoo-server/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/mnt/environment/odoo-server/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/mnt/develop/odoo-server/addons/web/controllers/main.py", line 935, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/mnt/develop/odoo-server/addons/web/controllers/main.py", line 927, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/mnt/environment/odoo-server/odoo/api.py", line 756, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/mnt/environment/odoo-server/odoo/api.py", line 743, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/mnt/develop/odoo-server/addons/mail/models/mail_thread.py", line 283, in write
result = super(MailThread, self).write(values)
File "/mnt/environment/connector/component_event/models/base.py", line 102, in write
result = super(Base, self).write(vals)
File "/mnt/environment/odoo-server/odoo/models.py", line 3208, in write
self._write(store_vals)
File "/mnt/environment/odoo-server/odoo/models.py", line 3430, in _write
self.recompute()
File "/mnt/environment/odoo-server/odoo/models.py", line 5096, in recompute
vals = {n: rec[n] for n in ns}
File "/mnt/environment/odoo-server/odoo/models.py", line 5096, in
vals = {n: rec[n] for n in ns}
File "/mnt/environment/odoo-server/odoo/models.py", line 4944, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/mnt/environment/odoo-server/odoo/fields.py", line 974, in __get__
value = record.env.cache.get(record, self)
File "/mnt/environment/odoo-server/odoo/api.py", line 1041, in get
value = self._data[key][field][record._ids[0]]
KeyError: 79
The KeyError: 79 is the id of the bom line.
Any idea? Thanks!
Here are some ideas about your error.
main_endado_bind has been declared with char data type. So it always stores char values.
According to your code, it seems parent_external_id has integer value. And you are assigning integer values to char data type fields. So it doesn't work.
To resolve this issue, we have to explicitly type cast into char. For example,
product.main_endado_bind = str(parent_external_id)
I have error when try to receive data from column.
Model is:
class int_filial_phone(models.Model):
_name = 'pr_filials.int_filial_phone'
name = fields.Char(string="Partner-number") #, compute='_get_name_field')
number = fields.Char(string="Phone")
active = fields.Boolean(string="Active")
filial_addr_ids = fields.One2many('pr_filials.filial_addr', 'int_filial_phone_id', string='Address')
filial_id = fields.Many2one('res.company', string='Filial')
advert_phone_ids = fields.One2many('pr_filials.advert_phone', 'int_filial_phone_id', 'Advert phone')
_sql_constraints = [
('number_unique',
'UNIQUE(number)',
"The parameter number must be unique"),
]
Methods:
def find_client_in_filial_phone(self, phone, table):
cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
result = None
table = request.env[table]
phone = self.format_symbol_phone(phone)
_logger.error('find_client_in_filial_phone phone: %r ', phone )
ids = table.sudo().search([['number', '=', phone],], limit=1)
if(len(ids)>0):
result = table.sudo().browse(ids)[0]
_logger.error('find_client_in_filial_phone result: %r ', result )
return result
I try to receive record id:
int_phone = self.find_client_in_filial_phone(data[3], 'pr_filials.int_filial_phone')
int_phone_id = int(int_phone.id)
All work fine
When i try to receive another field of record:
_logger.error("PHONE NAME: %r", int_phone[0].name)
I receive error:
Traceback (most recent call last): File
"/home/skif/odoo/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception) File "/home/skif/odoo/openerp/http.py", line 685, in dispatch
result = self._call_function(**self.params) File "/home/skif/odoo/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs) File "/home/skif/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs) File "/home/skif/odoo/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw) File "/home/skif/odoo/openerp/http.py", line 964, in call
return self.method(*args, **kw) File "/home/skif/odoo/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw) File "/home/skif/odoo/openerp/my-addons/pr_finance/controllers/controllers.py",
line 151, in upload_file
_logger.error("PHONE INT : %r", int_phone[0].name) File "/home/skif/odoo/openerp/fields.py", line 830, in get
self.determine_value(record) File "/home/skif/odoo/openerp/fields.py", line 930, in determine_value
record._prefetch_field(self) File "/home/skif/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs) File "/home/skif/odoo/openerp/models.py", line 3308, in _prefetch_field
result = records.read([f.name for f in fs], load='_classic_write') File "/home/skif/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs) File "/home/skif/odoo/openerp/models.py", line 3238, in read
self._read_from_database(stored, inherited) File "/home/skif/odoo/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs) File "/home/skif/odoo/openerp/models.py", line 3376, in _read_from_database
cr.execute(query_str, params) File "/home/skif/odoo/openerp/sql_db.py", line 141, in wrapper
return f(self, *args, **kwargs) File "/home/skif/odoo/openerp/sql_db.py", line 220, in execute
res = self._obj.execute(query, params) File "/home/skif/.local/lib/python2.7/site-packages/psycopg2/extensions.py",
line 129, in getquoted
pobjs = [adapt(o) for o in self._seq] ProgrammingError: can't adapt type 'pr_filials.int_filial_phone'
How I can receive data from record? Why i received id but cannot received data from other fields of record?
In the new version of the api, when you used the method "search", the value return is a recordSet.
Example:
Old api version
record_ids = self.pool.get('model.name').search([('name', '=', 'Jon doe')])
# The value of record_ids is like [1,2,3,4]
records = self.pool.get('model.name').browse(records_ids)
# The value of records is like model.name(1,2,3,4)
In the new version of api
records = self.env['model.name'].search([('name', '=', 'Jondoe')])
# The vale of records is like model.name(1,2,3,4)
In your code you try to browse with recordSet.
def find_client_in_filial_phone(self, phone, table):
...
ids = table.sudo().search([['number', '=', phone],], limit=1)
# Here ids is a recordSet
if(len(ids)>0):
result = table.sudo().browse(ids)[0]
_logger.error('find_client_in_filial_phone result: %r ', result )
return result
You must do like this.
def find_client_in_filial_phone(self, phone, table):
cr, uid, context, registry = request.cr, request.uid, request.context, request.registry
table = request.env[table]
phone = self.format_symbol_phone(phone)
_logger.error('find_client_in_filial_phone phone: %r ', phone )
result = table.sudo().search([['number', '=', phone],], limit=1)
_logger.error('find_client_in_filial_phone result: %r ', result )
return result
If your search doesn't find value, an empty recordSet is return.
I want to override the default value for a field with the default_get API function in odoo9.
I have this in my code:
#api.model
def default_get(self, fields_list):
res = super(hr_attendance, self).default_get(fields_list)
res.update({
'animal': 'dog'
})
return res
When I create a new register, this error appears in the odoo log:
2016-09-02 11:33:36,680 27542 ERROR mydb openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/etc/odoo/server/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/etc/odoo/server/openerp/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/etc/odoo/server/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/etc/odoo/server/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/etc/odoo/server/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw)
File "/etc/odoo/server/openerp/http.py", line 964, in __call__
return self.method(*args, **kw)
File "/etc/odoo/server/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw)
File "/etc/odoo/server/addons/web/controllers/main.py", line 888, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/etc/odoo/server/addons/web/controllers/main.py", line 880, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/etc/odoo/server/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/etc/odoo/server/openerp/api.py", line 354, in old_api
result = method(recs, *args, **kwargs)
File "/etc/odoo/server/addons_extra/hr_attendance_extend/hr_attendance.py", line 79, in default_get
res.update({
AttributeError: 'tuple' object has no attribute 'update'
What I am doing wrong?
Edit: I had another variable with the same name which provoqued conflict.
Renaming the variable, everything works perfect.
update is a method of dictionary data-type. And you are trying to use it with tuple data-type. That's reason you got error.
Try with following code:
#api.model
def default_get(self, fields):
res = super(hr_attendance, self).default_get(fields)
res['animal'] = 'dog'
return res
How can I use search_count?
**[controllers.py]**
def register_session(self, prevouseURL, currentURL):
remoteAddr = request.httprequest.environ['REMOTE_ADDR']
_logger.error("currentURL : %r", currentURL)
registerSession = SessionVisitor()
url = URLList()
_logger.error(url.search_count([('url', '=', currentURL)])>0)
**[models.py]**
class URLList(models.Model):
_name = 'webvisitorcalc.url_list'
url = fields.Char(string="URL", required=True)
target_session_id = fields.One2many('webvisitorcalc.session_visitor', 'target_url_ids', string='Target URL')
In this situation i am receiving error:
*2016-06-06 14:41:33,108 30086 ERROR odoov8 openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/skif/odoo/openerp/http.py", line 540, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/skif/odoo/openerp/http.py", line 577, in dispatch
result = self._call_function(**self.params)
File "/home/skif/odoo/openerp/http.py", line 313, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/skif/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/skif/odoo/openerp/http.py", line 310, in checked_call
return self.endpoint(*a, **kw)
File "/home/skif/odoo/openerp/http.py", line 806, in __call__
return self.method(*args, **kw)
File "/home/skif/odoo/openerp/http.py", line 406, in response_wrap
response = f(*args, **kw)
File "/home/skif/odoo/my-modules/webvisitorcalc/controllers.py", line 31, in register_session
_logger.error(url.search_count([('url', '=', currentURL)])>0)
AttributeError: 'NoneType' object has no attribute 'search_count'*
Ok. I modified code.
**[controllers.py]**
def register_session(self, prevouseURL, currentURL):
remoteAddr = request.httprequest.environ['REMOTE_ADDR']
_logger.error("currentURL : %r", currentURL)
registerSession = SessionVisitor()
url = URLList()
_logger.error(url.search_count([('url', '=', currentURL)])>0)
if url.url_exist(currentURL):
_logger.info("URL exist in DB ")
else:
_logger.info("URL NOT exist in DB ")
**[models.py]**
class URLList(models.Model):
_name = 'webvisitorcalc.url_list'
url = fields.Char(string="URL", required=True)
target_session_id = fields.One2many('webvisitorcalc.session_visitor', 'target_url_ids', string='Target URL')
#api.multi
def url_exist(self, urlForCheck):
_logger.error("Check URL exist in DB ")
result = False
if (self.search_count([('url', '=', urlForCheck)])>0):
result = True
return result
I'm receive error:
*2016-06-06 14:56:50,797 30796 ERROR odoov8 openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/skif/odoo/openerp/http.py", line 540, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/skif/odoo/openerp/http.py", line 577, in dispatch
result = self._call_function(**self.params)
File "/home/skif/odoo/openerp/http.py", line 313, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/skif/odoo/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/skif/odoo/openerp/http.py", line 310, in checked_call
return self.endpoint(*a, **kw)
File "/home/skif/odoo/openerp/http.py", line 806, in __call__
return self.method(*args, **kw)
File "/home/skif/odoo/openerp/http.py", line 406, in response_wrap
response = f(*args, **kw)
File "/home/skif/odoo/my-modules/webvisitorcalc/controllers.py", line 33, in register_session
if url.url_exist():
AttributeError: 'NoneType' object has no attribute 'url_exist'*
In doc (https://www.odoo.com/documentation/8.0/howtos/backend.html) present:
**[openacademy/models.py]**
...
#api.multi
def copy(self, default=None):
default = dict(default or {})
copied_count = self.search_count([('name', '=like', u"Copy of {}%".format(self.name))])
...
In doc (http://odoo-new-api-guide-line.readthedocs.io/en/latest/environment.html?highlight=search#model) present:
>>> self.search_count([('is_company', '=', True)])
26L
I can not understand what I forgot add in my code. Why do I receive errors?
in odoo (fromerly openERP) i want to customize Project management module.
currently a task can be assigned to a single user. model code is:
class task(osv.osv):
_name = "project.task"
_description = "Task"
'user_id': fields.many2one('res.users', 'Assigned to', select=True, track_visibility='onchange'),
Now want to assign a task to multiple users. and i have modified user_id field like this:
'user_id': fields.many2many('res.users', 'Assigned to', select=True, track_visibility='onchange'),
but it shows following traceback:
Traceback (most recent call last):
File "/home/hardik/odoo/odoo/openerp/http.py", line 537, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/hardik/odoo/odoo/openerp/http.py", line 574, in dispatch
result = self._call_function(**self.params)
File "/home/hardik/odoo/odoo/openerp/http.py", line 310, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/http.py", line 307, in checked_call
return self.endpoint(*a, **kw)
File "/home/hardik/odoo/odoo/openerp/http.py", line 803, in __call__
return self.method(*args, **kw)
File "/home/hardik/odoo/odoo/openerp/http.py", line 403, in response_wrap
response = f(*args, **kw)
File "/home/hardik/odoo/odoo/addons/web/controllers/main.py", line 884, in search_read
return self.do_search_read(model, fields, offset, limit, domain, sort)
File "/home/hardik/odoo/odoo/addons/web/controllers/main.py", line 905, in do_search_read
request.context)
File "/home/hardik/odoo/odoo/openerp/http.py", line 908, in proxy
result = meth(cr, request.uid, *args, **kw)
File "/home/hardik/odoo/odoo/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/models.py", line 5146, in search_read
result = self.read(cr, uid, record_ids, fields, context=read_ctx)
File "/home/hardik/odoo/odoo/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/models.py", line 3141, in read
result = BaseModel.read(records, fields, load=load)
File "/home/hardik/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/models.py", line 3176, in read
self._read_from_database(stored, inherited)
File "/home/hardik/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/models.py", line 3354, in _read_from_database
res2 = self._columns[f].get(cr, self._model, ids, f, user, context=context, values=result)
File "/home/hardik/odoo/odoo/openerp/osv/fields.py", line 1012, in get
cr.execute(query, [tuple(ids),] + where_params)
File "/home/hardik/odoo/odoo/openerp/sql_db.py", line 158, in wrapper
return f(self, *args, **kwargs)
File "/home/hardik/odoo/odoo/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
ProgrammingError: syntax error at or near "to"
LINE 1: SELECT Assigned to.res_users_id, Assigned to.project_task_id...
^
please guide me how to deal with this. thanks in advance
When we create many2many type field, than we must to give a name of relation table where in that table record will store. In below example 'task_user_rel' is a relational table.
You may try this code:
'user_ids': fields.many2many('res.users', 'task_user_rel', 'user_id', 'id', 'Assigned to', select=True, track_visibility='onchange'),
Now add new user_ids field in xml side and hide/invisible a exists user_id field.