function field

Asked by ange bouabre on 2012-05-10

Hi everybody, i'm new on openerp and i'm stopped in my work. i would like to do a field function which calculate the multiplication of others fields: this is my code:

 lass vigne_class(osv.osv):
    _name = 'vigne.class'

    def _devis_taillage_hectare(self,cr,uid,ids,field_names,context=None):
  for i in champs:

  return res

    _columns = {
        'vigne_ids': fields.many2one('client.class',"Propriétaire", readonly=True, select=True, ondelete='cascade'),
        'nom': fields.char("Nom de vigne",size=64),
        'guyot':fields.selection([('s','Simple'), ('d','Double')],'Guyot'),
        'nbr_plantsfacture': fields.integer("Nombre de Plants facturé"),
        'prix1': fields.float("Prix",digits=(3,3),help="Prix du taillage"),

 I get an error when i update my module:
File "/usr/lib/pymodules/python2.6/openerp/", line 212, in execute
 res = self._obj.execute(query, params)
ProgrammingError: can't adapt

I need your help please!!!! :(

Question information

English Edit question
Odoo Addons (MOVED TO GITHUB) Edit question
No assignee Edit question
Last query:
Last reply:

Please correct me if I am wrong, but if you pass to "self.browse" a simple id instad of a list with a simple id, the function regutns one instance of a class and not a list of instances. Try doing this to see if it works:

champs = self.browse(cr,uid,ids,context)
if not isinstance(champs, list):
    champs = [champs]

Can you help with this problem?

Provide an answer of your own, or ask ange bouabre for more information if necessary.

To post a message you must log in.