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

Hi, is there a possibility to reset sequences monthly. especially urvhase orders? thx for your ideas

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You need to include the month in your sequence and set Implementation to No Gap.

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

No Gap implementation does not reset sequence number when it comes to the next month.

This worked for me on earlier version of openERP. however, you are write its not working now. Do you know how to do it?

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

http://github.com/buke/openerp-ir-sequence-autoreset

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Even though the question has been asked long time ago, I'm giving an answer that may be usefull for other users :

I inherited ir.sequence, and overrided _next method in order to reset number_next_actual to 1 if the current year and the last year are not equal (you can replace year by mounth according to your needs), it seems to work fine for me (odoo 9)


class sequence(models.Model):
    _inherit = 'ir.sequence'
last_year = fields.Integer("last",default=1)

def _next(self):
        thisyear=int(date.today().year)
 if thisyear!=self.last_year:
            self.last_year=thisyear
self.number_next_actual=1
result = super(sequence,self)._next()
return result
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You can certainly set up a sequence that has month as part of the number (e.g PO/Mar13/001). What I am not sure about is if the trailing sequence resets. I can see how you can reset each year under fiscal years.

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