Cédric Krier pushed to branch branch/6.6 at Tryton / Tryton


Commits:
da4f1ee3 by Adrià Tarroja Caubet at 2023-03-09T15:26:25+01:00
Skip sale lines without the type line to compute credit amount

Closes #12130
(grafted from b88f769c4fefad32f528d686766799549249dae3)
- - - - -
173e5079 by Cédric Krier at 2023-03-30T22:36:18+02:00
Do not fails to clear password from cache if there is no cache

This was introduced in 7b5157206d32

Closes #12165
(grafted from 2c557f1b4882006ec487e11f4e0b8aed1ef37860)
- - - - -
814cba14 by Cédric Krier at 2023-04-01T00:18:01+02:00
Clear password hash read even if there is no cache

This was introduced by 2c557f1b4882
(grafted from 8ae09df296211e3517e3f485c1efbea590662a5b)
- - - - -


2 changed files:

- modules/sale_credit_limit/party.py
- trytond/trytond/res/user.py


Changes:

=====================================
modules/sale_credit_limit/party.py
=====================================
@@ -32,7 +32,7 @@
             amount = 0
             for line in sale.lines:
                 quantity = line.quantity
-                if not quantity:
+                if not quantity or (line.type != 'line'):
                     continue
                 for invoice_line in line.invoice_lines:
                     if invoice_line.type != 'line':


=====================================
trytond/trytond/res/user.py
=====================================
@@ -364,7 +364,7 @@
     @classmethod
     def read(cls, ids, fields_names):
         result = super(User, cls).read(ids, fields_names)
-        cache = Transaction().get_cache()[cls.__name__]
+        cache = Transaction().get_cache().get(cls.__name__)
         for values in result:
             if 'password_hash' in values:
                 values['password_hash'] = None
@@ -368,7 +368,7 @@
         for values in result:
             if 'password_hash' in values:
                 values['password_hash'] = None
-            if values['id'] in cache:
+            if cache and values['id'] in cache:
                 cache[values['id']]['password_hash'] = None
         return result
 
@@ -379,5 +379,4 @@
         users = super().search(
             domain, offset=offset, limit=limit, order=order, count=count,
             query=query)
-        cache = Transaction().get_cache()[cls.__name__]
         if not count and not query:
@@ -383,7 +382,9 @@
         if not count and not query:
-            for user in users:
-                if user.id in cache:
-                    cache[user.id]['password_hash'] = None
+            cache = Transaction().get_cache().get(cls.__name__)
+            if cache is not None:
+                for user in users:
+                    if user.id in cache:
+                        cache[user.id]['password_hash'] = None
         return users
 
     @classmethod



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/9a6bb51bcefbe62fbfb51c01db1bbc3eaca95220...814cba1445bc89568c98b5bc632866a65511ddd0

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/9a6bb51bcefbe62fbfb51c01db1bbc3eaca95220...814cba1445bc89568c98b5bc632866a65511ddd0
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to