res_partner.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # -*- coding: utf-8 -*-
  2. ##############################################################################
  3. #
  4. # OpenERP, Open Source Management Solution
  5. # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
  6. # 'sectorial_id': fields.related('repetidora_id', 'sectorial_id', type='many2one', string='Sectorial', relation='res.repetidora.sectorial'),
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as
  9. # published by the Free Software Foundation, either version 3 of the
  10. # License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. # 'sectorial_id': fields.many2one("res.repetidora.sectorial", 'Sectorial', ondelete='restrict'),
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. ##############################################################################
  21. from openerp import tools, api
  22. from openerp.osv import osv
  23. from openerp.osv import fields
  24. from openerp.tools.translate import _
  25. import openerp.addons.decimal_precision as dp
  26. import time
  27. class res_partner(osv.osv):
  28. _name = 'res.partner'
  29. _inherit = 'res.partner'
  30. _description = 'Add data of internet'
  31. _columns = {
  32. 'ip_interno': fields.char('IP Interno'),
  33. 'repetidora_id': fields.many2one('res.repetidora', 'Repetidora', ondelete='restrict', select=1),
  34. 'sectorial_id': fields.many2one("res.repetidora.sectorial", 'Sectorial', ondelete='restrict'),
  35. }
  36. _defaults = {
  37. }
  38. @api.onchange('sectorial_id')
  39. def onchange_sectorial(self):
  40. if self.sectorial_id:
  41. self.repetidora_id = self.sectorial_id.repetidora_id
  42. # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: