Guest User

Untitled

a guest
Jan 23rd, 2015
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class emplacement(ModelSQL, ModelView):
  2. u'Emplacement'
  3. __name__ = 'cg.emplacement'
  4. _rec_name = 'code'
  5.  
  6. code = fields.Integer(
  7. string = u'Code emplacement',
  8. help=u'Code de l\'emplacement',
  9. required = True,
  10. states=STATES,
  11. depends=DEPENDS,
  12. )
  13.  
  14. evolution = fields.One2Many(
  15. 'cg.evol_emplacement',
  16. 'emplacement',
  17. string=u'Évolutions',
  18. help=u'Évolutions de l\'emplacement',
  19. states=STATES,
  20. depends=DEPENDS,
  21. )
  22. number_of_evolutions = fields.Function(fields.Integer('Evolutions Nº'), 'on_change_with_number_of_evolutions')
  23.  
  24. @fields.depends('evolution'):
  25. def on_change_with_number_of_evolutions(self, name=None):
  26. return len(self.evolution)
  27.  
  28. @staticmethod
  29. def default_number_of_evolutions():
  30. return 0
  31.  
  32. class evol_emplacement(ModelSQL, ModelView):
  33. u'Évolution d\'un emplacement'
  34. __name__ = 'cg.evol_emplacement'
  35.  
  36. emplacement = fields.Many2One(
  37. 'cg.emplacement',
  38. string=u'Emplacement',
  39. help=u'Emplacement',
  40. )
RAW Paste Data