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

Odoo v11 Community

Sale Order Sequence Prefix: SO/%(range_y)s%(month)s

Sequence Size: 4

Use subsequences per date_range: True

Current Date: 04/08/2018

 When creating a new Sales Order and setting the order date (to say 07/6/17) I would expect the Order Reference Number to be "SO/17070001" but instead it's "SO/18040001" . Is there a way to change this or line of code to edit?

Looking back at Quotation section the Order Date set became the Quotation Date and the actual Order Date listed in Sales section shows the current date and time the Sales Order was created.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

The easiest work around I found is change the system date/time and make Odoo think it's the date wanted.

الصورة الرمزية
إهمال
أفضل إجابة

Hi, 

You can't make that by changing the sequence prefix from the UI. You need some customization here.

First  Make the Sale Order Sequence Prefix back to 'SO' (By Default by Odoo).

Then try this code in your custom module.

class SaleOrder(models.Model):
_inherit = 'sale.order'

@api.model
def create(self, vals):
res = super(SaleOrder, self).create(vals)
order_date = res.date_order
sequence = res.name
res.name = 'SO' + '/' + order_date[2:4] + order_date[5:7] + sequence[2:]
return res

Thank you.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مايو 24
8057
1
أبريل 22
7628
1
سبتمبر 20
6535
0
مارس 19
3140
2
سبتمبر 17
21534