← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 802813] [NEW] Applied Promotions cleared before applying next promotion

 

Public bug reported:

Hi,

>From my testing it appears that a severe bug exists.

"clear_existing_promotion_lines()" is called for every promotion.

Should only be called ONCE in when "applying" promotions.

As the code is, only the LAST promotion will remain on the order.

Hope below diff is readable. Also my original diff was quite larger dues
to trailing white-space in code as I a added vim a modeline to the code.

regards mark


diff based on extra-addons revno: 5390

=== modified file 'sale_promotions/models/rules.py'
--- sale_promotions/models/rules.py	2011-06-27 14:30:25 +0000
+++ sale_promotions/models/rules.py	2011-06-28 04:13:25 +0000
@@ -332,6 +332,9 @@
         """
         order = self.pool.get('sale.order').browse(cursor, user,
                                                    order_id, context=context)
+
+        self.pool.get('promos.rules.actions').clear_existing_promotion_lines(cursor, user, order, context)
+
         active_promos = self.search(cursor, user,
                                     [('active', '=', True)],
                                     context=context)
@@ -741,7 +744,7 @@
         'arguments':fields.char('Arguments', size=100),
         'promotion':fields.many2one('promos.rules', 'Promotion'),
     }
-    
+
     def clear_existing_promotion_lines(self, cursor, user,
                                         order, context=None):
         """

** Affects: oosalespromotions
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/802813

Title:
  Applied Promotions cleared before applying next promotion

Status in Sales Promotions in Open ERP:
  New

Bug description:
  Hi,

  From my testing it appears that a severe bug exists.

  "clear_existing_promotion_lines()" is called for every promotion.

  Should only be called ONCE in when "applying" promotions.

  As the code is, only the LAST promotion will remain on the order.

  Hope below diff is readable. Also my original diff was quite larger
  dues to trailing white-space in code as I a added vim a modeline to
  the code.

  regards mark

  
  diff based on extra-addons revno: 5390

  === modified file 'sale_promotions/models/rules.py'
  --- sale_promotions/models/rules.py	2011-06-27 14:30:25 +0000
  +++ sale_promotions/models/rules.py	2011-06-28 04:13:25 +0000
  @@ -332,6 +332,9 @@
           """
           order = self.pool.get('sale.order').browse(cursor, user,
                                                      order_id, context=context)
  +
  +        self.pool.get('promos.rules.actions').clear_existing_promotion_lines(cursor, user, order, context)
  +
           active_promos = self.search(cursor, user,
                                       [('active', '=', True)],
                                       context=context)
  @@ -741,7 +744,7 @@
           'arguments':fields.char('Arguments', size=100),
           'promotion':fields.many2one('promos.rules', 'Promotion'),
       }
  -    
  +
       def clear_existing_promotion_lines(self, cursor, user,
                                           order, context=None):
           """

To manage notifications about this bug go to:
https://bugs.launchpad.net/oosalespromotions/+bug/802813/+subscriptions


Follow ups

References