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

production lot number creation

By
kaynis
on 5/22/13, 2:34 PM 1,216 views

Hi All, Using V6.1 on windows I basically want to design a class or function in an existing module, probably the stock module, that would allow the system to create production lot number based on the current date and number of production lot that has been created on that day. I have written a code that I think would do the job but I do not know where exactly to put it. The python code is below which is quite simple. This is to make tracking of product even easier for the company and employees

currentid=None;

#currentid='1130206'

if currentid==None or currentid=='':

   currentid='1'+time.strftime('%y%d%m')

else:

   idpart=currentid[0:-6];

datepart=currentid[1:];

#print (idpart)

#print (datepart)

idpartint=int(idpart)

if time.strftime('%y%d%m')==datepart:

    currentid=str(idpartint+1)+datepart

else:

    currentid='1'+time.strftime('%y%d%m')

#print (currentid)

prodt_lot = currentid

the series should look something like 1132205,2132205...x132205 for the 22May2013 then the next day should start from 1 again looking like this 1132305,2132305...x132305 etc as oppose to the current seven digit number e.g 0000007 generated by the system

Thank you.
Can anyone help please?

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/22/13, 2:34 PM
Seen: 1216 times
Last updated: 3/16/15, 8:10 AM