Commits

jmartin  committed 774cc86

Use a list of dictionaries in create()

  • Participants
  • Parent commits 1811b90

Comments (0)

Files changed (1)

                     })
 
     @classmethod
-    def create(cls, vals):
-        User = Pool().get('res.user')
-        user = User(Transaction().user)
-        
-        if not user.shop:
-            cls.raise_user_error('not_sale_shop')
-
-        vals = vals.copy()
-        vals['shop'] = user.shop.id
-        return super(Sale, cls).create(vals)
+    def create(cls, vlist):
+        for vals in vlist:
+            User = Pool().get('res.user')
+            user = User(Transaction().user)
+            
+            if not user.shop:
+                cls.raise_user_error('not_sale_shop')
+    
+            vals = vals.copy()
+            vals['shop'] = user.shop.id
+        return super(Sale, cls).create(vlist)
 
     @classmethod
     def write(cls, sales, vals):