Hello community,

here is the log from the commit of package trytond_purchase for 
openSUSE:Factory checked in at 2020-05-17 23:43:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/trytond_purchase (Old)
 and      /work/SRC/openSUSE:Factory/.trytond_purchase.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "trytond_purchase"

Sun May 17 23:43:12 2020 rev:13 rq:806127 version:5.0.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/trytond_purchase/trytond_purchase.changes        
2020-04-05 20:54:56.349274943 +0200
+++ 
/work/SRC/openSUSE:Factory/.trytond_purchase.new.2738/trytond_purchase.changes  
    2020-05-17 23:43:18.173073888 +0200
@@ -1,0 +2,5 @@
+Sat May 16 06:58:55 UTC 2020 - Axel Braun <[email protected]>
+
+- Version 5.0.4 - Bugfix Release
+
+-------------------------------------------------------------------

Old:
----
  trytond_purchase-5.0.3.tar.gz

New:
----
  trytond_purchase-5.0.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ trytond_purchase.spec ++++++
--- /var/tmp/diff_new_pack.4sa7bK/_old  2020-05-17 23:43:18.937075422 +0200
+++ /var/tmp/diff_new_pack.4sa7bK/_new  2020-05-17 23:43:18.937075422 +0200
@@ -17,7 +17,7 @@
 
 %define majorver 5.0
 Name:           trytond_purchase
-Version:        %{majorver}.3
+Version:        %{majorver}.4
 Release:        0
 Summary:        The "purchase" module for the Tryton ERP system
 License:        GPL-3.0

++++++ trytond_purchase-5.0.3.tar.gz -> trytond_purchase-5.0.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_purchase-5.0.3/.hgtags 
new/trytond_purchase-5.0.4/.hgtags
--- old/trytond_purchase-5.0.3/.hgtags  2020-04-04 17:58:39.000000000 +0200
+++ new/trytond_purchase-5.0.4/.hgtags  2020-05-15 21:46:28.000000000 +0200
@@ -22,3 +22,4 @@
 f5ebf3ae588b8321f3cb5b88a93b49519e060701 5.0.1
 7617dfc0c2d4af432fb4771a23dd6b5108c90137 5.0.2
 54cfae61c08cf28a173a156eb4af4532e76f71cc 5.0.3
+6b440414be2890f9e78ad361687f5ed8dde8e6ff 5.0.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_purchase-5.0.3/CHANGELOG 
new/trytond_purchase-5.0.4/CHANGELOG
--- old/trytond_purchase-5.0.3/CHANGELOG        2020-04-04 17:58:39.000000000 
+0200
+++ new/trytond_purchase-5.0.4/CHANGELOG        2020-05-15 21:46:27.000000000 
+0200
@@ -1,3 +1,6 @@
+Version 5.0.4 - 2020-05-15
+* Bug fixes (see mercurial logs for details)
+
 Version 5.0.3 - 2020-04-04
 * Bug fixes (see mercurial logs for details)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_purchase-5.0.3/PKG-INFO 
new/trytond_purchase-5.0.4/PKG-INFO
--- old/trytond_purchase-5.0.3/PKG-INFO 2020-04-04 17:58:40.000000000 +0200
+++ new/trytond_purchase-5.0.4/PKG-INFO 2020-05-15 21:46:29.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: trytond_purchase
-Version: 5.0.3
+Version: 5.0.4
 Summary: Tryton module for purchase
 Home-page: http://www.tryton.org/
 Author: Tryton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_purchase-5.0.3/product.py 
new/trytond_purchase-5.0.4/product.py
--- old/trytond_purchase-5.0.3/product.py       2019-02-28 22:43:56.000000000 
+0100
+++ new/trytond_purchase-5.0.4/product.py       2020-05-09 00:43:29.000000000 
+0200
@@ -82,6 +82,31 @@
                             'change_purchase_uom')
         super(Template, cls).write(*args)
 
+    @classmethod
+    def copy(cls, templates, default=None):
+        pool = Pool()
+        ProductSupplier = pool.get('purchase.product_supplier')
+        if default is None:
+            default = {}
+        else:
+            default = default.copy()
+
+        copy_suppliers = 'product_suppliers' not in default
+        default.setdefault('product_suppliers', None)
+        new_templates = super().copy(templates, default)
+        if copy_suppliers:
+            old2new = {}
+            to_copy = []
+            for template, new_template in zip(templates, new_templates):
+                to_copy.extend(
+                    ps for ps in template.product_suppliers if not ps.product)
+                old2new[template.id] = new_template.id
+            if to_copy:
+                ProductSupplier.copy(to_copy, {
+                        'template': lambda d: old2new[d['template']],
+                        })
+        return new_templates
+
 
 class Product(metaclass=PoolMeta):
     __name__ = 'product.product'
@@ -161,6 +186,35 @@
                         prices[product.id], currency, round=False)
         return prices
 
+    @classmethod
+    def copy(cls, products, default=None):
+        pool = Pool()
+        ProductSupplier = pool.get('purchase.product_supplier')
+        if default is None:
+            default = {}
+        else:
+            default = default.copy()
+
+        copy_suppliers = 'product_suppliers' not in default
+        if 'template' in default:
+            default.setdefault('product_suppliers', None)
+        new_products = super().copy(products, default)
+        if 'template' in default and copy_suppliers:
+            template2new = {}
+            product2new = {}
+            to_copy = []
+            for product, new_product in zip(products, new_products):
+                if product.product_suppliers:
+                    to_copy.extend(product.product_suppliers)
+                    template2new[product.template.id] = new_product.template.id
+                    product2new[product.id] = new_product.id
+            if to_copy:
+                ProductSupplier.copy(to_copy, {
+                        'product': lambda d: product2new[d['product']],
+                        'template': lambda d: template2new[d['template']],
+                        })
+        return new_products
+
 
 class ProductSupplier(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
     'Product Supplier'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/trytond_purchase-5.0.3/tryton.cfg 
new/trytond_purchase-5.0.4/tryton.cfg
--- old/trytond_purchase-5.0.3/tryton.cfg       2019-03-15 19:29:18.000000000 
+0100
+++ new/trytond_purchase-5.0.4/tryton.cfg       2020-04-04 17:58:49.000000000 
+0200
@@ -1,5 +1,5 @@
 [tryton]
-version=5.0.3
+version=5.0.4
 depends:
     account
     account_invoice
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/trytond_purchase-5.0.3/trytond_purchase.egg-info/PKG-INFO 
new/trytond_purchase-5.0.4/trytond_purchase.egg-info/PKG-INFO
--- old/trytond_purchase-5.0.3/trytond_purchase.egg-info/PKG-INFO       
2020-04-04 17:58:40.000000000 +0200
+++ new/trytond_purchase-5.0.4/trytond_purchase.egg-info/PKG-INFO       
2020-05-15 21:46:28.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: trytond-purchase
-Version: 5.0.3
+Version: 5.0.4
 Summary: Tryton module for purchase
 Home-page: http://www.tryton.org/
 Author: Tryton


Reply via email to