twanda / vertical-agriculture

Verticalization of Odoo for farms and agroindustries
GNU Affero General Public License v3.0
0 stars 1 forks source link

Current stock in partner list view #42

Closed dastcaboz closed 2 years ago

dastcaboz commented 3 years ago

I tried to integrate the current stock in the list view but got an error message. Please resolve this and add the current stock in partner list views.

stock_in-list-view view_current-stock

Error: Odoo Server Error

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/api.py", line 1049, in get value = self._data[key][field][record._ids[0]] KeyError: 96

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1064, in get value = record.env.cache.get(record, self) File "/usr/lib/python3/dist-packages/odoo/api.py", line 1051, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: ('res.partner(96,).current_stock_count', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/models.py", line 4767, in ensure_one _id, = self._ids ValueError: too many values to unpack (expected 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 656, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise raise value File "/usr/lib/python3/dist-packages/odoo/http.py", line 698, in dispatch result = self._call_function(self.params) File "/usr/lib/python3/dist-packages/odoo/http.py", line 346, in _call_function return checked_call(self.db, *args, *kwargs) File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 98, in wrapper return f(dbname, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call result = self.endpoint(*a, kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 941, in call return self.method(*args, *kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 519, in response_wrap response = f(args, kw) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 905, in search_read return self.do_search_read(model, fields, offset, limit, domain, sort) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 927, in do_search_read offset=offset or 0, limit=limit or False, order=sort or False) File "/usr/lib/python3/dist-packages/odoo/models.py", line 4634, in search_read result = records.read(fields) File "/usr/lib/python3/dist-packages/odoo/models.py", line 2837, in read vals[name] = convert(record[name], record, use_name_get) File "/usr/lib/python3/dist-packages/odoo/models.py", line 5169, in getitem return self._fields[key].get(self, type(self)) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1068, in get self.determine_value(record) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1181, in determine_value self.compute_value(recs) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1135, in compute_value self._compute_value(records) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1126, in _compute_value getattr(records, self.compute)() File "/opt/Odoo12/extra-addons/twanda/vertical-agriculture/vertical_agriculture/models/partner.py", line 94, in _compute_current_stock_count quants_ids = self.env['stock.quant'].search([('location_id', 'child_of', self.property_stock_supplier.ids)]) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1062, in get record.ensure_one() File "/usr/lib/python3/dist-packages/odoo/models.py", line 4770, in ensure_one raise ValueError("Expected singleton: %s" % self) ValueError: Expected singleton: res.partner(96, 99, 100, 102, 103, 108, 109, 110, 111, 127)

treviser commented 3 years ago

@dastcaboz I suppose, this should only be meant to work on the farmers tree view, not for general contacts.

dastcaboz commented 3 years ago

Yes, only in farmer list views.

candidroot commented 2 years ago

@treviser I already Commit code please take latest pull and upgrade module then check it, is there any issue then please let me know, thanks

treviser commented 2 years ago

@dastcaboz Please check.

dastcaboz commented 2 years ago

List view of farmers is still the same on test and life version.

Bildschirmfoto 2021-11-01 um 12 32 09
candidroot commented 2 years ago

@treviser Hello, still i think latest code is not on server, so please first take latest pull on test server and live server then upgrade module,then check it, thanks