← Back to team overview

openerp-india team mailing list archive

[Bug 1126141] [NEW] cr.fetchall() can't get a value of a stored function in the database

 

Public bug reported:

When we herit from hr_payroll module I encounter a bug, please follow me
:

class hr_payslip(osv.osv):
    _inherit = 'hr.payslip'
        
    def _compute_slip_worked2(self, cr, uid, ids, field_name, arg, context):
        if not context : context = {}
        res = {}
        for slip in self.browse(cr, uid, ids, context=context) :
            sb = 0.0
            for line in slip.line_ids :
                    sb += line.total
            res[slip.id] = {
                'sb_val': sb,
            }
        return res
        
    _columns = {
        'payment_mode': fields.char('Mode de paiement', size=64),
        'sb_val': fields.function(_compute_slip_worked2, method=True, type='float', string='Salaire brut', store=True, multi='compute_valss',),
    }
hr_payslip()

When I compute the payslip I get 10 lines with the sum = 23400 but
'sb_val' equal 0 <-- This is the problem, sb_val must equal 23400 not 0

When I edit code, modfying sb += line.total to sb += 3 I get 30 so there
is an interfernce that prevent the calcul and this is a bug because the
field total in the object hr.payslip.line is a stored function

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


** Tags: fetchall interference request sql

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

Title:
  cr.fetchall() can't get a value of a stored function in the database

Status in OpenERP Addons (modules):
  New

Bug description:
  When we herit from hr_payroll module I encounter a bug, please follow
  me :

  class hr_payslip(osv.osv):
      _inherit = 'hr.payslip'
          
      def _compute_slip_worked2(self, cr, uid, ids, field_name, arg, context):
          if not context : context = {}
          res = {}
          for slip in self.browse(cr, uid, ids, context=context) :
              sb = 0.0
              for line in slip.line_ids :
                      sb += line.total
              res[slip.id] = {
                  'sb_val': sb,
              }
          return res
          
      _columns = {
          'payment_mode': fields.char('Mode de paiement', size=64),
          'sb_val': fields.function(_compute_slip_worked2, method=True, type='float', string='Salaire brut', store=True, multi='compute_valss',),
      }
  hr_payslip()

  When I compute the payslip I get 10 lines with the sum = 23400 but
  'sb_val' equal 0 <-- This is the problem, sb_val must equal 23400 not
  0

  When I edit code, modfying sb += line.total to sb += 3 I get 30 so
  there is an interfernce that prevent the calcul and this is a bug
  because the field total in the object hr.payslip.line is a stored
  function

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


Follow ups

References