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

hello,

i want to change the sale quotation numbers easily like in odoo V8, how it's possible ?

  • Screen odoo v9 : http://hpics.li/f3699e2

  • Screen odoo v8 : http://hpics.li/35a8a30

Thanks in advance,

Have a nice day.

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

- activate the developer mode

- go to "Settings/Sequences & Identifiers/Sequences"


Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for this tips but there is no way to change it like in Version 8 ? (module or tips)

What exactly is your problem, creating different sequences for quotations and sales orders or creating a sequence in the style of your example? If it is the latter, please see my amended answer

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

It will help you

override create function in model sale.order

from openerp import models 
import datetime


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

    def create(self, cr, uid, vals, context=None):
        if context is None:
            context = {}
        if vals.get('name', '/') == '/':
            vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'sale.order', context=context) or '/'
        # ================== ADDITIONAL LINES ================================================
        now = datetime.datetime.now()
        vals['name'] = vals['name'].replace('SO', now.year) # GIVE YEAR FOR EXAMPLE
        # ====================================================================================
        if vals.get('partner_id') and any(f not in vals for f in ['partner_invoice_id', 'partner_shipping_id', 'pricelist_id', 'fiscal_position']):
            defaults = self.onchange_partner_id(cr, uid, [], vals['partner_id'], context=context)['value']
            if not vals.get('fiscal_position') and vals.get('partner_shipping_id'):
                delivery_onchange = self.onchange_delivery_id(cr, uid, [], vals.get('company_id'), None, vals['partner_id'], vals.get('partner_shipping_id'), context=context)
                defaults.update(delivery_onchange['value'])
            vals = dict(defaults, **vals)
        ctx = dict(context or {}, mail_create_nolog=True)
        new_id = super(sale_order, self).create(cr, uid, vals, context=ctx)
        self.message_post(cr, uid, [new_id], body=_("Quotation created"), context=ctx)
        return new_id
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
Sales quotation Đã xử lý
2
thg 3 24
3316
1
thg 3 15
5101
1
thg 3 15
4216
0
thg 8 25
4080
1
thg 11 23
2410