Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2596 Lượt xem

for example:

.....

NO = fields.Char('Number')

Modifier=fields.Many2one('res.users',string='Creator')

.....

I want the effect:

when somebody modified the field "NO"; his/her name should be record by "Modifier";

I use "onchange" and "depends", but failed; could you give me some advice?

Ảnh đại diện
Huỷ bỏ

Please share whatever code you have tried already.

Câu trả lời hay nhất

Hi,

You just have to check if NO field is modified or not and then store the current logged in user's ID in modifier.

EX:

@api.multi
def write(self, vals):
if 'NO' in vals:
vals.update({'Modifier': self._uid})
return super(your_class_name, self).write(vals)


Ảnh đại diện
Huỷ bỏ
Tác giả

it is so cool; these code meets my requirement perfectly.

Thank you very much for your time and effort.