I wanna customize the name of purchase order like yyyymmdd_n. yymmdd is the date of the purchase order created, and n is the sequence number from 1 the order created on that day. However, the default value of n depends on the total count. I searched for the purchase order's creation in purchase.py and made some logging in some possible functions such as create_po, create_procurement_purchase_order. But when a new purchase order was created, none of them were called based on the logging details.
Is there someone who can give me a hand?
The method create in class purchase_order defines:
order = super(purchase_order, self).create(cr, uid, vals,context=context)
I am looking for the code for `super(...).create(...)
Update on 2016/5/11: I found a simple way from this
I guess you need to create a sequence per each month (if not present, auto-create it) and use the right one on create.
By default in the create
method it does this
vals['name'] = self.env['ir.sequence'].next_by_code('purchase.order')
so, you must intercept that and do your stuff, then you call the base model, something like:
super(model.Model, self).create([...])
HTH