← Back to team overview

openerp-community team mailing list archive

openerp module development issue

 

Excuse me everyone, I develop a module in openerp and I'm stuck in my work.I
know I'm not allowed to send emails that way but I have no choice. I
really need
your help to continue. It's been a week since I did not advance. I just can
not help me please:


I created 2 objects 'client.class' and 'vigne.class' with one2many and
many2one fields because one client.class can get one or more vigne.class :


 *class client_class*(osv.osv) :


 _name = 'client.class'

_inherit = 'res.partner'

_order ='nom'

_columns = {

 *'client_id':fields.one2many('vigne.class','vigne_ids',"Vignes",
ondelete='set null')*, #'vigne'

'date':fields.datetime("Date de Creation"),

'nom': fields.char("Nom et Prenom",size=128),

'phone': fields.char("Téléphone",size=64),

'note': fields.text("Note")

….

….

….


 }



 *class vigne_class*(osv.osv) :


 _name = 'vigne.class'

 _order ='vigne_ids'

 def create(self, cr, uid, vals, context={}): ### Fonction pour la séquence

vals['ref'] = self.pool.get('ir.sequence').get(cr, uid, 'vigne.class')

res = super(vigne_class, self).create(cr, uid, vals, context)

return res


 _columns = {

'date':fields.datetime("Date de Creation"),

 *'vigne_ids': fields.many2one('client.class',"Client", readonly=True,
ondelete='cascade',select=True),*

'nom': fields.char("Nom de vigne",size=64),

'guyot':fields.selection([('s','Simple'), ('d','Double')],'Guyot'),

'lieu': fields.char("Lieu",size=64),

'nbr_treill': fields.integer("Nombre de treilles")

 *'devis_taillage_total'*: fields.float("Prix",digits=(10,2),readonly=True),

*'duree_taillage'*:fields.float("Durée du taillage(h)",digits=(10,2))

….

….

….

 }


 I stocked value in fields *'duree_taillage' *and *'devis_taillage_total**'*
* *of* **vigne_class** *and cause some * **client_class* have one or many *
vigne_class*, i would like to *compute the sum** *of these fields *
'duree_taillage'** *and *'**devis_taillage_total'** *for each *client_class*
* *objects created.


 ex : *client_class_object.**sum_duree_taillage =
**vigne_class_1.**duree_taillage+
**vigne_class_2.**duree_taillage+ **vigne_class_3.**duree_taillage*

and

*client_class_object.**sum_devis_taillage_total = **
**vigne_class_1.**devis_taillage_total+
**vigne_class_2.**devis_taillage_total+ **vigne_class_3.**
devis_taillage_total*


How browse the *vigne_class* objects of one *client_class* object and get
these fields to compute them??







 There is a complete information in attachment file. PLEASE HELP ME.

Attachment: help_me_please.pdf
Description: Adobe PDF document


Follow ups

References