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

condition based sequences

By
evon_dun
on 5/1/13, 4:39 AM 1,341 views

Hi, I have a module that depends on sale module and i have used sale order in my views, i want to generate sequence for only the orders which have new field values according to the new module. How can i do that?? If i create sequence from openerp menu than it applies the new sequence field to all the previous orders too. urgent help required! Thanks in advance

i inherited sale order and added two new fields named chalan and chalan_number, i want the chalan_number generated if chalan's value is 'Chalan'. If i create a sequence then the chalan number is entered in all the previously made sale orders.

evon_dun
on 5/1/13, 5:48 AM

You need create custom python code with check your new field.

Vasiliy Birukov
on 5/1/13, 11:21 AM

If i create sequence from Openerp settings menu than is it possible to generate that sequence with condition on clicking compute button in sale_order view?

evon_dun
on 5/6/13, 8:38 AM
1
Atchuthan
On 7/1/13, 3:17 AM

By using ORM method create, you can provide conditional sequence to any field and also by using the condition, we can even select which sequence to load for a particular field, so for your case:

def create(self, cr, uid, vals, context=None):
        if vals.get('chalan')=='Chalan':
             if vals.get('chalan_number','/')=='/':
                 vals['chalan_number'] = self.pool.get('ir.sequence').get(cr, uid, 'your_sequence_name') or '/'     
             return super(your_class_name,self).create(cr, uid, vals, context=context)
0
evon_dun
On 5/1/13, 5:48 AM

i inherited sale order and added two new fields named chalan and chalan_number, i want the chalan_number generated if chalan's value is 'Chalan'. If i create a sequence then the chalan number is entered in all the previously made sale orders.

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

0 follower(s)

Stats

Asked: 5/1/13, 4:39 AM
Seen: 1341 times
Last updated: 3/16/15, 8:10 AM