ir.sequence 以外的 sale.order 需要打印五个序列号
Need to print Five sequence number for one sale.order other than ir.sequence
我已经编写代码为 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)
让我试着帮忙。
start = self.id //sales-order id
limit = start + 5
for x in range(start, limit):
if not tickets:
tickets = x
else:
tickets = tickets + ',' + x
我已经编写代码为 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)
让我试着帮忙。
start = self.id //sales-order id
limit = start + 5
for x in range(start, limit):
if not tickets:
tickets = x
else:
tickets = tickets + ',' + x