仅按小时和分钟排序

时间:2017-08-25 10:13:10

标签: openerp odoo-10

如何仅按小时和分钟添加序列?如果我在A上写%(h24)s%(min)s,则从配置中显示类似23461

的内容



prefix




1 个答案:

答案 0 :(得分: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.
        """        

        ...