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


Commits:
98a50724 by Cédric Krier at 2023-03-07T18:10:25+01:00
Add trailing / to URLs of DPD shipping services

Closes #12098
(grafted from a6b41e6401ec070f5cdf97115bfd2c22c3dccdac)
- - - - -
6d623980 by Sergi Almacellas Abellana at 2023-03-09T13:37:12+01:00
Use inventory company to complete lines

Closes #12127
(grafted from 5282d0322326c6abe1b98cb1dee1565064257e4f)
- - - - -
4c29dcd3 by Cédric Krier at 2023-03-15T16:09:10+01:00
Do not copy password hash nor reset from user
(grafted from c94f99afeadbc10e483ed3d34d707635f77ac945)
- - - - -
45a9fa50 by Cédric Krier at 2023-03-15T09:53:02+01:00
Reset next number of invoice sequences when renew fiscal year
(grafted from fcf3710fa6cf50cc25de17b6e65acdc7f96a3510)
- - - - -
e049697d by Cédric Krier at 2023-03-18T13:12:30+01:00
Remove password hash also from the transaction cache

Closes #12120
(grafted from 7b5157206d328bfe020fabece59fb7747dd2dd9d)
- - - - -


5 changed files:

- modules/account_invoice/account.py
- modules/stock/inventory.py
- modules/stock_package_shipping_dpd/configuration.py
- modules/web_user/user.py
- trytond/trytond/res/user.py


Changes:

=====================================
modules/account_invoice/account.py
=====================================
@@ -326,8 +326,9 @@
             for field in self.invoice_sequence_fields:
                 sequence = getattr(invoice_sequence, field, None)
                 sequences[sequence.id] = sequence
-        copies = Sequence.copy(list(sequences.values()), default={
-                'next_number': 1,
+        copies = Sequence.copy(list(sequences.values()))
+        Sequence.write(copies, {
+                'number_next': Sequence.default_number_next(),
                 })
 
         mapping = {}


=====================================
modules/stock/inventory.py
=====================================
@@ -221,7 +221,9 @@
                 product_ids = None
             else:
                 product_ids = [l.product.id for l in inventory.lines]
-            with Transaction().set_context(stock_date_end=inventory.date):
+            with Transaction().set_context(
+                    company=inventory.company.id,
+                    stock_date_end=inventory.date):
                 pbl = Product.products_by_location(
                     [inventory.location.id],
                     grouping=grouping,


=====================================
modules/stock_package_shipping_dpd/configuration.py
=====================================
@@ -11,8 +11,8 @@
     'production': 'https://public-ws.dpd.com/services/',
     }
 
-LOGIN_SERVICE = 'LoginService/V2_0?wsdl'
-SHIPMENT_SERVICE = 'ShipmentService/V3_2?wsdl'
+LOGIN_SERVICE = 'LoginService/V2_0/?wsdl'
+SHIPMENT_SERVICE = 'ShipmentService/V3_2/?wsdl'
 
 
 def get_client(server, service):


=====================================
modules/web_user/user.py
=====================================
@@ -152,6 +152,13 @@
         cls.save(users)
 
     @classmethod
+    def copy(cls, users, default=None):
+        default = default.copy() if default is not None else {}
+        default['password_hash'] = None
+        default['reset_password_token'] = None
+        return super().copy(users, default=default)
+
+    @classmethod
     def create(cls, vlist):
         users = super(User, cls).create(vlist)
         cls._format_email(users)


=====================================
trytond/trytond/res/user.py
=====================================
@@ -354,6 +354,7 @@
     @classmethod
     def read(cls, ids, fields_names=None):
         result = super(User, cls).read(ids, fields_names=fields_names)
-        if not fields_names or 'password_hash' in fields_names:
-            for values in result:
+        cache = Transaction().get_cache().get(cls.__name__)
+        for values in result:
+            if 'password_hash' in values:
                 values['password_hash'] = None
@@ -359,4 +360,6 @@
                 values['password_hash'] = None
+            if cache and values['id'] in cache:
+                cache[values['id']]['password_hash'] = None
         return result
 
     @classmethod
@@ -360,6 +363,20 @@
         return result
 
     @classmethod
+    def search(
+            cls, domain, offset=0, limit=None, order=None, count=False,
+            query=False):
+        users = super().search(
+            domain, offset=offset, limit=limit, order=order, count=count,
+            query=query)
+        cache = Transaction().get_cache().get(cls.__name__)
+        if not count and not query:
+            for user in users:
+                if cache and user.id in cache:
+                    cache[user.id]['password_hash'] = None
+        return users
+
+    @classmethod
     def create(cls, vlist):
         vlist = [cls._convert_vals(vals) for vals in vlist]
         res = super(User, cls).create(vlist)
@@ -433,7 +450,8 @@
             default = {}
         default = default.copy()
 
-        default['password'] = ''
+        default['password_hash'] = None
+        default['password_reset'] = None
         default.setdefault('warnings')
         default.setdefault('applications')
 



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/78d66830c08122df20a2fa1ddf6deca76ca4685d...e049697d1fa13b19a5ef24f8bdba042ec0a0fe5c

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/compare/78d66830c08122df20a2fa1ddf6deca76ca4685d...e049697d1fa13b19a5ef24f8bdba042ec0a0fe5c
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to