Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
2352 Vistas

Hi,


I try for my first custom module, to add '-customer' in the name if I change his name, juste for test if my @onchange call works correctly.  😌


And... it doesn't work, nothing happens !  😏


The module is installed correctly. Here is my module structure : 


Speaker 

    > __init__.py

    > __openerp__.py

    > res_partner.py


__init__.py : 

import res_partner


res_partner.py : 


# -*- coding: utf-8 -*-

from openerp import models, fields, api, _
from openerp.exceptions import except_orm,Warning, ValidationError
from openerp.addons.base_openprod import utils

import logging
from openerp.osv import expression
_schema = logging.getLogger(__name__ + '.schema')


class res_partner(models.Model):
_name = 'res.partner'
_inherit = ['res.partner']
_order = 'reference, name'

@api.onchange('is_other_third_party')
def _onchange_nameotherparty(self):

if self.is_other_third_party:
self.name = self.name + "-otherparty"
return {
'warning': {
'title': "Change",
'message': "Name was changed",
}
}


Where did I screw up ? 🤔


Thanks ! 






Avatar
Descartar
Autor Mejor respuesta

Edit : Sorry, It works ! 


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 15
3519
2
mar 15
4504
0
abr 25
913
2
ene 24
2182
2
oct 15
6667