我有一个在其中创建日期字段的模块,该日期字段我希望在我完成发票的编译时将其添加为发票日期。在发票模型中,date_invoice字段
for rec in (active_records - rec_to_exclude):
for line in rec.invoice_line_ids:
same_line = InvLine.search([
('invoice_id', '=', new_rec_id.id),
('product_id','=',line.product_id.id),
('price_unit','=',line.price_unit),
('discount','=',line.discount),
#('invoice_line_tax_ids','in',line.invoice_line_tax_ids.ids),
], limit=1)
if same_line:
same_line.quantity += line.quantity
else:
InvLine.create({
'product_id': line.product_id and line.product_id.id or False,
'quantity' : line.quantity,
'uom_id' : line.uom_id.id,
'price_unit' : line.price_unit,
'invoice_id': new_rec_id.id,
'name': line.name,
'discount': line.discount,
'account_id': line.account_id.id,
'invoice_date_invoice': self.date_invoicea,
'invoice_line_tax_ids': [(6,0, line.invoice_line_tax_ids.ids)]
})
for record in self:
record[(date_invoice)] = record(date_invoicea)
我尝试了几种功能,但是没有用。