quinta-feira, 9 de maio de 2013

Cálculo de Horas - Openerp - Python

    def onchange_hours_out(self, cr, uid, ids, hours_out=0.0, hours_in=0.0, datex=None, datex_out=None):
        #pdb.set_trace(),
        dataEnt = date(*time.strptime(datex,'%Y-%m-%d')[:3])
        dataSai = date(*time.strptime(datex_out,'%Y-%m-%d')[:3])
        diferencaDias =((dataSai-dataEnt).days*24),
        return {'value':{'hours': ((hours_out - hours_in)+diferencaDias[0])}}




                     hi = time.strptime('09:30', '%H:%M')
                    hit = float(time.strftime('%H', hi)) + (float(time.strftime('%M',hi))/60)
                    ho = time.strptime('16:15', '%H:%M')
                    hot = float(time.strftime('%H', ho)) + (float(time.strftime('%M',ho))/60)

                    dte = date(*time.strptime(str('20/03/13'),'%d/%m/%y')[:3])
                    dts = date(*time.strptime(str('20/03/13'),'%d/%m/%y')[:3])
                    diferencaDias =((dts-dte).days*24)
                    ht = diferencaDias + (hot - hit)

terça-feira, 7 de maio de 2013

Uncaught Error: NameError: name 'project_id' is not defined

OpenERP Client error
Uncaught Error: NameError: name 'project_id' is not defined


  • step 1. go to menu(more->setting->Technical->user interface->view
  • step 2. look for "phase.task.search.form" , click Form view
  • step 3. click Edit , em seguida,
      <field name="phase_id"/>
      then add domain="[]" de modo a se tornar 
      <field name="phase_id" domain="[]"/>
    
  • step 4. click save and you error should by now solve.


    copiado de : http://help.openerp.com/question/5762/uncaught-error-in-project-task-page-search-bar/