Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
5246 Weergaven

Hii All,

I have applied copy function for "duplicate" button. But after applying this function my record is not saved.  Here "create" and "new" are states selection field. But when i save "duplicate" record then state is not changed from "create" to "new". It consist only "create". Can anyone check it. Here is my python code for copy function.

def copy(self, cr, uid, id, default=None, context=None):

        if default is None:

            default = {}

            print "default", default

            default['create'] = ['new']

        return super(sun_helpdesk, self).copy(cr, uid, id, default, context)

Avatar
Annuleer
Beste antwoord

Which version do you use ?

#v7

Edit `copy` function like this:

def copy(self, cr, uid, id, default=None, context=None):
        if default is None:
            default = {}
        default.update({'state': 'new'})
        return super(sun_helpdesk, self).copy(cr, uid, id, default, context)

#v10 

Remove `copy` function in your model and declare field `state` like this:

state = fields.Selection([('new', 'New'), ('create', 'Create')], string='Status', default='new', copy=False)
Avatar
Annuleer
Auteur Beste antwoord

Thank you, it's work. But what can i do when i require current state from where i click on duplicate button and save.

Avatar
Annuleer

Sorry, i don't understand your question.

Could you explain more detail ?

Gerelateerde posts Antwoorden Weergaven Activiteit
1
aug. 17
4205
0
aug. 17
3137
1
apr. 25
3680
3
dec. 22
11601
5
apr. 24
42160