Skip to Content
Menu
This question has been flagged
1119 Views

this is my button function

@api.model 

def get_stock_file(self):

​form_view_id =self.env.ref("kw_handbook.kw_onboarding_attachment_form").id

​return {'type': 'ir.actions.act_window',

                     'res_model': 'kw_onboarding_handbook',

​   'view_mode': 'form',

                     'res_id': self.id,

                     'view_id': form_view_id,

                     'target': 'new',

​ }


this is compute method

@api.depends('user_ids')

def_compute_check_read(self):

        for record in self:

             if self.env.user in record.user_ids:

​record.already_seen_boolean = True

​    else: 

​record.already_seen_boolean = False







Odoo Server Error

Traceback (most recent call last): File "/home/localadmin/odoo-dev/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 684, in dispatch result = self._call_function(**self.params) File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 360, in _call_function return checked_call(self.db, *args, **kwargs) File "/home/localadmin/odoo-dev/odoo/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 348, in checked_call result = self.endpoint(*a, **kw) File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 913, in __call__ return self.method(*args, **kw) File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 532, in response_wrap response = f(*args, **kw) File "/home/localadmin/odoo-dev/odoo/addons/web/controllers/main.py", line 1389, in call_kw return self._call_kw(model, method, args, kwargs) File "/home/localadmin/odoo-dev/odoo/addons/web/controllers/main.py", line 1381, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/localadmin/odoo-dev/odoo/odoo/api.py", line 399, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/home/localadmin/odoo-dev/odoo/odoo/api.py", line 386, in _call_kw_multi result = method(recs, *args, **kwargs) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3022, in read return self._read_format(fnames=fields, load=load) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3042, in _read_format vals[name] = convert(record[name], record, use_name_get) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 5675, in __getitem__ return self._fields[key].__get__(self, type(self)) File "/home/localadmin/odoo-dev/odoo/odoo/fields.py", line 1021, in __get__ self.compute_value(recs) File "/home/localadmin/odoo-dev/odoo/odoo/fields.py", line 1177, in compute_value records._compute_field_value(self) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 4070, in _compute_field_value getattr(self, field.compute)() File "/home/localadmin/odoo-dev/odoo/kwantify-erp-14/kw_handbook/models/kw_onboarding_handbook.py", line 60, in _compute_check_read if self.env.uid in record.user_ids.ids: File "/home/localadmin/odoo-dev/odoo/odoo/fields.py", line 2485, in __get__ return super().__get__(records, owner) File "/home/localadmin/odoo-dev/odoo/odoo/fields.py", line 998, in __get__ recs._fetch_field(self) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3071, in _fetch_field self._read(fnames) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3141, in _read self.check_access_rule('read') File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3347, in check_access_rule invalid = self - self._filter_access_rules_python(operation) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 3402, in _filter_access_rules_python return self.sudo().filtered_domain(dom or []) File "/home/localadmin/odoo-dev/odoo/odoo/models.py", line 5341, in filtered_domain value = normalize(value) File "/home/localadmin/odoo-dev/odoo/odoo/fields.py", line 1916, in to_datetime return datetime.strptime(value, DATETIME_FORMAT[:len(value)-2]) File "/usr/lib/python3.8/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/lib/python3.8/_strptime.py", line 345, in _strptime raise ValueError("stray %% in format '%s'" % format) from None Exception The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 640, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/localadmin/odoo-dev/odoo/odoo/http.py", line 316, in _handle_exception raise exception.with_traceback(None) from new_cause ValueError: stray % in format '%'

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 24
2814
2
Jun 24
2023
0
Oct 24
195
1
Jul 23
803
0
Nov 24
162