2017-08-25 78 views
2

如何只添加小時和分鐘的序列?從如果我寫上prefix%(h24)s%(min)s的配置,它表明類似23461只有小時和分鐘的序列

<data noupdate="1"> 
 

 
     
 
     <record id="seq_order" model="ir.sequence"> 
 
      <field name="name">test Order</field> 
 
      <field name="code">test.model</field> 
 
      <field name="prefix"></field> 
 
      <field name="padding">3</field> 
 
      <field name="company_id" eval="False"/> 
 
     </record> 
 

 
    </data>

+0

'23461'有什麼問題? 23是小時,46是分鐘,1是序號。 – MICROCOM

回答

0

目前還沒有辦法與如何ir.sequence作品做到這一點。您需要擴展模型並添加功能以不顯示實際序列號(但這可能會破壞將所有序列一起使用的目的,我會讓您決定這一點)。

class IrSequence(models.Model): 
    """ Sequence model. 

    The sequence model allows to define and use so-called sequence objects. 
    Such objects are used to generate unique identifiers in a transaction-safe 
    way. 
    """ 
    _inherit = 'ir.sequence' 
    skip = fields.Boolean('Skip Sequence Number', help='Mark to true to not display the sequence number in the sequence, only use the prefix/suffix.') 

    def _next(self): 
     """ 
     Override this to extend ir.sequence to not use the next 
     sequence number. 
     """  

     ... 

    def get_next_char(self, number_next): 
     """ 
     Override this to extend ir.sequence to not use the next 
     sequence number. 
     """   

     ...