Tryton - Issues

 

Issue6672

Title Unable to update product cost_price
Priority bug Status need-eg
Superseder Nosy List ced, pokoli, reviewbot
Type crash Components product
Assigned To Keywords review
Reviews 35571002
View: 35571002

Created on 2017-07-25.10:56:09 by pokoli, last changed by ced.

Messages
msg36226 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-10-11.18:08:55
Maybe the cached directory of pip.
msg36225 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-11.18:06:26
I cleared it several times, upgraded tox and the issue still repeat.
msg36223 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-10-11.18:00:07
Clean your tox environment.
msg36221 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-10-11.17:47:39
Indeed its something strange as I can only reproduce when running a test scenario of a module under tox. The bug does not raise when running the run-tests script. 

I can not reproduce it on a normal database with the same configuration as the test scenario. 

Any idea?
msg35945 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-09-30.00:06:14
I can not reproduce the traceback.
Please provide a scenario.
review35571002 updated at https://codereview.tryton.org/35571002/#ps20001
review35571002 updated at https://codereview.tryton.org/35571002/#ps1
msg35220 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-08-17.17:16:56
Indeed, I can reproduce the traceback when trying to update the product cost price using the wizard. 

I added review35571002 which should fix it.
msg34769 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:45:09
On 2017-07-25 11:27, Sergi Almacellas Abellana wrote:
> El 25/07/17 a les 11:19, Cédric Krier ha escrit:
> > For me, it is wrong to add CompanyMultiValueMixin because the original design did not want to have multi-company for that value.
> 
> Then how we should fix the Attribute error?

I do not know.
msg34768 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:45:07
On 2017-07-25 11:17, Sergi Almacellas Abellana wrote:
> El 25/07/17 a les 11:16, Cédric Krier ha escrit:
> > I do not understand the first sentence of msg34760.
> 
> Let me clarify: It should be possible to define a diferent default_cost_price_method on each company created on the system.

I do not agree, this is customization.
msg34767 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:27:38
El 25/07/17 a les 11:19, Cédric Krier ha escrit:
> For me, it is wrong to add CompanyMultiValueMixin because the original design did not want to have multi-company for that value.

Then how we should fix the Attribute error?
msg34766 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:19:35
For me, it is wrong to add CompanyMultiValueMixin because the original design did not want to have multi-company for that value.
msg34765 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:17:56
El 25/07/17 a les 11:16, Cédric Krier ha escrit:
> I do not understand the first sentence of msg34760.

Let me clarify: It should be possible to define a diferent default_cost_price_method on each company created on the system.
msg34764 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-07-25.11:16:29
I do not understand the first sentence of msg34760.
review40561003 updated at https://codereview.tryton.org/40561003/#ps1
msg34760 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-07-25.10:56:09
The default_cost_price of the product.configuration should be possible to have a different value depending on the company. 

Since changeset d0488db05044 this causes the following crash:

Exception raised:
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest scenario_base_workflows.rst[77]>", line 1, in <module>
        template.save()
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/proteus/__init__.py", line 101, in newfunc
        return self.func(owner, [instance], *args, **kwargs)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/proteus/__init__.py", line 758, in save
        ids = proxy.create(values, context)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/proteus/config.py", line 172, in __call__
        result = rpc.result(meth(*args, **kwargs))
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/modules/product/product.py", line 159, in create
        return super(Template, cls).create(vlist)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelsql.py", line 595, in create
        field.set(cls, fname, *fargs)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/one2many.py", line 217, in set
        Target.create(to_create)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/modules/product_variant_unique/product.py", line 312, in create
        return super(Product, cls).create(vlist)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelsql.py", line 604, in create
        cls._validate(sub_records)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1088, in _validate
        value = getattr(record, field_name)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1369, in __getattr__
        read_data = self.read(list(ids), ffields.keys())
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelsql.py", line 778, in read
        getter_results = field.get(ids, cls, field_list, values=result)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 102, in get
        return dict((name, call(name)) for name in names)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 102, in <genexpr>
        return dict((name, call(name)) for name in names)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 96, in call
        return dict((r.id, method(r, name)) for r in records)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 96, in <genexpr>
        return dict((r.id, method(r, name)) for r in records)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/modules/product/product.py", line 264, in get_template
        value = getattr(self.template, name)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1369, in __getattr__
        read_data = self.read(list(ids), ffields.keys())
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelsql.py", line 778, in read
        getter_results = field.get(ids, cls, field_list, values=result)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 102, in get
        return dict((name, call(name)) for name in names)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 102, in <genexpr>
        return dict((name, call(name)) for name in names)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 96, in call
        return dict((r.id, method(r, name)) for r in records)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/fields/function.py", line 96, in <genexpr>
        return dict((r.id, method(r, name)) for r in records)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/multivalue.py", line 53, in _multivalue_getter
        value = self.get_multivalue(name)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/modules/company/model.py", line 25, in get_multivalue
        name, **pattern)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/multivalue.py", line 46, in get_multivalue
        setattr(value, name, func(**pattern))
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/modules/product/product.py", line 137, in default_cost_price_method
        'default_cost_price_method', **pattern)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/multivalue.py", line 41, in get_multivalue
        values = self.__values(name, pattern, match_none=False)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/multivalue.py", line 38, in __values
        if v.match(pattern, match_none=match_none)]
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/multivalue.py", line 87, in match
        return super(ValueMixin, self).match(pattern, match_none=match_none)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/match.py", line 12, in match
        value = getattr(self, field)
      File "/builds/base/.tox/py27-sqlite/lib/python2.7/site-packages/trytond/model/modelstorage.py", line 1226, in __getattr__
        raise AttributeError('"%s" has no attribute "%s"' % (self, name))
    AttributeError: "product.configuration.default_cost_price_method,1" has no attribute "company"
History
Date User Action Args
2017-10-11 18:08:55cedsetmessages: + msg36226
2017-10-11 18:06:26pokolisetmessages: + msg36225
2017-10-11 18:00:07cedsetmessages: + msg36223
2017-10-11 17:47:40pokolisetmessages: + msg36221
2017-09-30 00:06:15cedsetstatus: chatting -> need-eg
messages: + msg35945
2017-08-18 09:22:02pokolisetstatus: testing -> chatting
assignedto: pokoli ->
2017-08-17 18:03:17reviewbotsetmessages: + msg35223
2017-08-17 17:39:52reviewbotsetmessages: + msg35222
2017-08-17 17:16:56pokolisetreviews: 40561003 -> 35571002
messages: + msg35220
title: Product default cost price should depend on the company -> Unable to update product cost_price
2017-07-25 11:45:09cedsetmessages: + msg34769

Showing 10 items. Show all history (warning: this could be VERY long)