Advertisement
Guest User

Untitled

a guest
May 4th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. class Factures(models.Model):
  2.  86
  3.  93
  4.  94
  5.  95     _name = 'myname'
  6.  96     _description = "Generation Factures"
  7.  98
  8.  99     client_id = fields.Many2one('res.partner', string="Client",
  9. 100             ondelete="cascade", index=True)
  10. 101     services = fields.One2many('serviceupdated', 'id', string="services")
  11. 102
  12. 103     description = fields.Text(string="test")
  13. 104
  14. 105     @api.onchange('client_id')
  15. 106     def check_change(self):
  16. 107         res = {}
  17. 112         if self.client_id:
  18. 113             r = []
  19. 114             r.append({'name': "lool", 'description': "lolbis"})
  20. 115             r.append({'name': "lool2", 'description': "lolbisibis"})
  21. 116
  22. 117             res = {
  23. 118                     'value': {
  24. 119                         'description': "test123",
  25. 120                         'services': r
  26. 121                         }
  27. 122                 }
  28. 123         self.write(res)
  29.             return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement