changeset 44088955e9c8 in modules/stock:5.6
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=44088955e9c8
description:
        Use _get_for_product_domain to search revision in get_for_product

        Otherwise the revisions are not limited to the company.

        issue9310
        review313541002
        (grafted from 0450247ff6fb96dc9cf046ea2c4b9cea697a812d)
diffstat:

 product.py |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r 9a6c3d887a08 -r 44088955e9c8 product.py
--- a/product.py        Thu May 14 23:45:16 2020 +0200
+++ b/product.py        Tue May 19 18:43:47 2020 +0200
@@ -850,11 +850,14 @@
 
     @classmethod
     def get_for_product(cls, product):
-        revisions = cls.search(['OR',
-                ('product', '=', product.id),
-                [
-                    ('template', '=', product.template.id),
-                    ('product', '=', None),
+        revisions = cls.search([
+                cls._get_for_product_domain(),
+                ['OR',
+                    ('product', '=', product.id),
+                    [
+                        ('template', '=', product.template.id),
+                        ('product', '=', None),
+                        ],
                     ],
                 ],
             order=[('date', 'ASC'), ('id', 'ASC')])

Reply via email to