基地里有一个像这样的字段:
_name = "stock.location"
_columns =
{
'complete_name': fields.function(_complete_name, type='char',string="Full Location Name", store={'stock.location': (_get_sublocations, ['name', 'location_id', 'active'], 10)}),
}
我希望在我的向导中将complete_name字段类型更改为Char,并使用我自己的名为“compute.location.wizard”的客户模型,我该怎么做?
答案 0 :(得分:1)
如果您使用旧的api:
_inherit = "stock.location"
_columns =
{
# change the all data
# change anything you want
'complete_name': fields.function(_new_method_, type='new_type',string="Full Location Name", store={'stock.location': (_get_sublocations, ['name', 'location_id', 'active'], 10)}),
}
但是如果你可以使用新的api
from openerp import models, fields
...
_inherit = "stock.location"
complete_name = fields.Integer(compute="_your_new_method_");
# you can change one attribute but in your case i think you need to
# change the compute method too