Monday 15 July 2013

python - Create a second sequence, same object -


Purchase order is already a sequence, my first question is:

How can I make a second order?

How can I restrict this sequence to only a particular partner?

This is my code that I use, but obviously the first sequence is overridden.

  class purchase_order (osv.osv): _inherit = 'purchase.order' _name = 'purchase.order' def (self, cr, uid, wall, context = {}): vals [ 'Bic_code'] = self (cray, uid, wall, context) return ridge deep copy (self, cr, uid, id, default = none, context = none): default.update ({'biccode': self-paul .etet ('IRVissions'). Mill (CR, UID, 'purchase order')} Return super (porchase_order, self). _columns = {'bic_code': fields.char ('Referencia bic', size = 64, read only = true))} _defaults = {'Bic_code': Lambda Obj, CR , UID, Reference: obj.pool.get ('ir.sequence'). Receive (CR, uid, 'buy.order')}}   

purchase_order ()

XML sequence

  & lt ;; Xml version = "1.0" encoding = "UTF-8"? & Gt;   

  & lt; Record model = "ir.sequence.type" id = "seq_type_purchase_bic" & gt; & Lt; Field Name = "Name" & gt; Number_by_saivance & lt; / Field & gt; & Lt; Area name = "code" & gt; Buy.order.bic1 & lt; / Field & gt; & Lt; / Record & gt; & Lt; Record model = "ir.sequence" id = "seq_purchase_bic" & gt; & Lt; Field Name = "Name" & gt; Number_by_saivance & lt; / Field & gt; & Lt; Area name = "code" & gt; Buy.order.bic1 & lt; / Field & gt; & Lt; Area name = "prefix" 10670- & lt; / Field & gt; & Lt; Field name = "padding" & gt; 5 & ​​lt; / Field & gt; & Lt; / Record & gt; & Lt; / Data & gt;   

XML view

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt;   

  & lt; Record id = "view_back_form" model = "ir.ui.view"> & Lt; Area name = "name" & gt; Purchase.bic.order.form & lt; / Field & gt; & Lt; Field name = "model" & gt; Purchase.order & lt; / Field & gt; & Lt; Field name = "beercidi" riff = "buy.purch_order_form" /> & Lt; Field name = "arch" type = "xml" & gt; & Lt; Xpath expr = "/ form / group / field [@ name = 'date_order']" position = "after" & gt; & Lt; Area name = "bic_code" /> & Lt; / Xpath & gt; & Lt; / Region & gt; & Lt; / Record & gt; & Lt; / Data & gt;   

= "lesson">

You create a new sequence for purchase Okay for what has done.

Openerpap does not have any current functionality to restrict the special sequence for a particular partner, for that you have to do some optimization in your module,

when you purchase a new order If you create, purchase orders are generated in the sequence, overwrite the method of re-generation and add code, check the partner if the partner is related to the old sequence then the old Ukrm or new is generated sequence of new sequence

This lets hope

No comments:

Post a Comment