Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
i want to question ,
i will add sequence 'KODE CABANG' in Purchase Order (PO) Sequence, with format PO like
PO+'KODE CABANG'+2 DIGIT YEAR+2 DIGIT MONTH+5 DIGIT SEQUENCE ...
i have code 'KODE CABANG' like MML, HHO, ULZ, DBB ...
so, code 'KODE CABANG' show in field prefix or suffix in sequence form ..
what i do ?
If your requirement is very specific to PO (not to other sequences), then I would advise that you don't touch the ir.sequence. Make the sequence of PO to supply 2 DIGIT YEAR+2 DIGIT MONTH+5 DIGIT SEQUENCE. Then in the code where PO name is applied (it is during create method in v7.0, see odoo/addons/purchase/purchase.py), put the "PO"+KODE CABANG as a prefix to the already provided string.
If you need the KODE CABANG to be applicable for more than one sequences, then maybe it is worth considering to inherit ir.sequence and enhance it's _next method (see odoo/openerp/addons/base/ir/ir_sequence.py). The challange is how would you provide the information for KODE CABANG. Some models actually called _next in their default_get, which is called even before the model instance is created.
ok thanks ,
it works, with add method create, like :
def create(self, cr, uid, vals, context=None):
seq = self.pool.get('res.partner').browse(cr, uid, vals['partner_id'])
vals['name'] = self.pool.get('ir.sequence').get(cr, uid, seq.kd_sequence.code)
return super(purchase_order, self).create(cr, uid, vals, context=context)
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 12/16/14, 9:44 PM|
|Seen: 1687 times|
|Last updated: 3/16/15, 8:10 AM|