Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2420 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

Edit : Sorry, It works ! 


Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 15
3600
2
bře 15
4592
0
dub 25
1016
2
led 24
2250
2
říj 15
6725