需要为除ir.sequence以外的一个销售订单打印五个序列号

问题描述 投票:0回答:1

我已经写了代码以打印1个销售订单的五个序列号但它影响了最后一个销售订单号,它跳了5个订单号

我必须为1个没有ir序列的销售订单打印5个序列号

 ticket = fields.Char(string="Ticket", readonly=True, required=True, copy=False, default='New')

 @api.multi
  def action_confirm(self): 
    result = super(SaleOrder, self).action_confirm()

    len_count = []
    ticket_list = []
    tickets = ""
    count = 5
    for i in range(count):
        x = self.env['ir.sequence'].next_by_code('sale.order')
        if not len(len_count) == 5:
            if not tickets:
                tickets = x 
            else:
                tickets = tickets + ',' + x
    print tickets
    print 'abc'


    ticket_list.append(str(tickets))
    self.ticket = ticket_list
    print ticket_list
    ctx = dict(self.env.context or {})
    ctx.update({
        'sale_action_new': ticket_list,
        })    
    print ctx

    template = self.env.ref('sale_order.email_template_ticket')
    template.with_context(ctx).send_mail(self.id)
odoo any
1个回答
0
投票
让我尝试帮助。

start = self.id //sales-order id limit = start + 5 for x in range(start, limit): if not tickets: tickets = x else: tickets = tickets + ',' + x

© www.soinside.com 2019 - 2024. All rights reserved.