コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2366 ビュー

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 ! 






アバター
破棄
著作者 最善の回答

Edit : Sorry, It works ! 


アバター
破棄
関連投稿 返信 ビュー 活動
0
3月 15
3530
2
3月 15
4535
0
4月 25
933
2
1月 24
2190
2
10月 15
6682