← Back to team overview

openerp-india team mailing list archive

[Bug 1068215] [NEW] The framework ignores the filter fields of constraints

 

Public bug reported:

Here is the scenario to reproduce the issue on OpenERP 6.1 :
1. create a new DB
2. Install the enclosed module "constraint_bug"
3. Create a new sale order
4. Confirm the sale order : you will see in the output of openerp :

WRITE ids=[19], vals={'state': 'confirmed'}
CONSTRAINT ids= [19]
WRITE ids=[19], vals={'procurement_id': 9L}
CONSTRAINT ids= [19]

Here is the interesting code of my module "constraint_bug" :

class sale_order_line(osv.osv):
    _inherit = "sale.order.line"
    
    def _test_constraint(self, cr, uid, ids, context=None):
        print "CONSTRAINT ids=", ids
        return True
        
    def write(self, cr, uid, ids, vals, context=None):
        print "WRITE ids=%s, vals=%s" %(str(ids), unicode(vals))
        return super(sale_order_line, self).write(cr, uid, ids, vals, context=context)       

    def create(self, cr, uid, vals, context=None):
        print "CREATE vals=", vals
        return super(sale_order_line, self).create(cr, uid, vals, context=context)
        
    _constraints = [
        (_test_constraint,
            "We raise the error msgs inside the code", ['product_uom_qty']),
            ]
            
sale_order_line()


I should not have the message "CONSTRAINT ids= [19]"  when the write function doesn't include the field 'product_uom_qty'. As the logs show, when the write function is called on sale order lines with the field 'state', the constraint is triggered, althrough this constraint should only be triggered when there is a write on 'product_uom_qty' !

Maybe there is a good reason for this... I would love to know it !

** Affects: openobject-server
     Importance: Undecided
         Status: New

** Attachment added: "module to reproduce the bug"
   https://bugs.launchpad.net/bugs/1068215/+attachment/3402852/+files/constraint_bug.tar.gz

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Server.
https://bugs.launchpad.net/bugs/1068215

Title:
  The framework ignores the filter fields of constraints

Status in OpenERP Server:
  New

Bug description:
  Here is the scenario to reproduce the issue on OpenERP 6.1 :
  1. create a new DB
  2. Install the enclosed module "constraint_bug"
  3. Create a new sale order
  4. Confirm the sale order : you will see in the output of openerp :

  WRITE ids=[19], vals={'state': 'confirmed'}
  CONSTRAINT ids= [19]
  WRITE ids=[19], vals={'procurement_id': 9L}
  CONSTRAINT ids= [19]

  Here is the interesting code of my module "constraint_bug" :

  class sale_order_line(osv.osv):
      _inherit = "sale.order.line"
      
      def _test_constraint(self, cr, uid, ids, context=None):
          print "CONSTRAINT ids=", ids
          return True
          
      def write(self, cr, uid, ids, vals, context=None):
          print "WRITE ids=%s, vals=%s" %(str(ids), unicode(vals))
          return super(sale_order_line, self).write(cr, uid, ids, vals, context=context)       

      def create(self, cr, uid, vals, context=None):
          print "CREATE vals=", vals
          return super(sale_order_line, self).create(cr, uid, vals, context=context)
          
      _constraints = [
          (_test_constraint,
              "We raise the error msgs inside the code", ['product_uom_qty']),
              ]
              
  sale_order_line()

  
  I should not have the message "CONSTRAINT ids= [19]"  when the write function doesn't include the field 'product_uom_qty'. As the logs show, when the write function is called on sale order lines with the field 'state', the constraint is triggered, althrough this constraint should only be triggered when there is a write on 'product_uom_qty' !

  Maybe there is a good reason for this... I would love to know it !

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/1068215/+subscriptions


Follow ups

References