@api.multi
def create_form(self):
lasts = self.env['base.gather.zone.pos'].search([('id', '=', self.id)])
last = lasts[-1]
rows = int(last.rowno) + 1
columnnos = int(last.columnno) + 1
layernos = int(last.layerno) + 1
print(rows, columnnos, layernos)
records = []
print('gatherzone = %s' % last.gatherzone)
for row in range(1, rows):
for column in range(1, columnnos):
for layer in range(1, layernos):
if 0 < row < 10:
last.gatherpos = '12' + '-0' + str(row)
else:
last.gatherpos = '12' + '-' + str(row)
if 0 < column < 10:
last.gatherpos = str(last.gatherpos) + '-0' + str(column)
else:
last.gatherpos = str(last.gatherpos) + '-' + str(column)
if 0 < layer < 10:
last.gatherpos = str(last.gatherpos) + '-0' + str(layer)
else:
last.gatherpos = str(last.gatherpos) + '-' + str(layer)
last.gatherposno = last.gatherpos
record = {
'gatherzone': last.gatherzone,
'routename': last.routename.id,
'gatherpos': last.gatherpos,
'gatherposno': last.gatherposno,
'packs': last.packs,
'volume': last.volume,
'companynum': last.companynum,
'existspacks': last.existspacks,
'existsvolume': last.existsvolume,
'existcompanynum': last.existcompanynum,
'rowno': row,
'columnno': column,
'layerno': layer,
'gatherorder': last.gatherorder,
'usestatus': last.usestatus,
'memo': last.memo,
'gatherzoneid': last.gatherzoneid,
'routeid': last.routeid,
'seqid': last.seqid,
}
records.append(record)
for record in records:
self.env['base.gather.zone.pos'].create(record)
lasts.unlink()
odoo根据最后一条记录而批量生成然后删除最后的那条记录
最新推荐文章于 2023-05-09 16:30:54 发布