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


Commits:
0d81274d 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)
- - - - -
f0d49fea 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)
- - - - -
3ef5ea3e 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
=====================================
@@ -361,7 +361,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
@@ -365,7 +365,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
 
@@ -376,5 +376,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:
@@ -380,7 +379,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/93f5b7178ddd471058ffa8fc41baaf33b3b2b213...3ef5ea3e13a2c07bcc851259f1c738f725f77c5a

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/93f5b7178ddd471058ffa8fc41baaf33b3b2b213...3ef5ea3e13a2c07bcc851259f1c738f725f77c5a
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to