تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2404 أدوات العرض

Hi All,
i have a piece of code which working fine it set invoice sequence base on invocie date, let suppose i created invoice on 10/01/2024 so the above code generate sequence ,INV/2024/01/10/0001 ,when created another one INV/2024/01/10/0002 it ok now i want to create invoice on 23/03/2018 INV/2018/03/23/0001,INV/2018/03/23/0002,INV/2018/ 03/23/0003 
 when change the month in invoice date sequence should start form  INV/date/0001


 

py:
def action_post(self): 

rec = super().action_post() for record in self: 

invoice_date = record.invoice_date 

if invoice_date: 

invoice_date_str = format_date(invoice_date, format='yyyy/MM/dd', locale='en_US') next_invoice_sequence = self.env[ 'ir.sequence'].next_by_code('new.invoice. seq') record. name = ' INV/' + invoice_date_str + '/' + str(next_invoice_sequence) 

else: 

record.name = '/' 

record.payment_reference = record.name 

return  rec

xml:

 

    Invoice field > 

    new.invoice.seq field > 

    4 fields > 

    1 field > 

    1 field > 

     

     





الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 24
2000
2
نوفمبر 23
1885
4
مايو 25
1099
2
مايو 25
4165
1
مارس 25
592