Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Shall I record the user's name when he/she modify some fields?

By
vx2008
on 7/21/16, 3:53 AM 257 views

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?

Please share whatever code you have tried already.

Sudhir Arya (SA)
on 7/22/16, 3:00 PM
0

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
On 7/22/16, 3:03 PM

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)


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

Thank you very much for your time and effort.

vx2008
on 7/24/16, 9:10 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/21/16, 3:53 AM
Seen: 257 times
Last updated: 7/24/16, 9:10 AM