本文整理汇总了Python中trytond.pool.Pool.save方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.save方法的具体用法?Python Pool.save怎么用?Python Pool.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trytond.pool.Pool
的用法示例。
在下文中一共展示了Pool.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_discount_to_lines
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import save [as 别名]
def apply_discount_to_lines(cls, contracts):
Line = Pool().get('contract.line')
to_write = []
for contract in contracts:
for line in contract.lines:
old_unit_price = line.unit_price
line.update_prices()
if old_unit_price != line.unit_price:
to_write.append(line)
if to_write:
Line.save(to_write)
示例2: confirm
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import save [as 别名]
def confirm(cls, inventories):
Move = Pool().get('stock.move')
moves = []
for inventory in inventories:
keys = set()
for line in inventory.lines:
key = line.unique_key
if key in keys:
cls.raise_user_error('unique_line',
(line.rec_name, inventory.rec_name))
keys.add(key)
move = line.get_move()
if move:
moves.append(move)
if moves:
Move.save(moves)
Move.do(moves)
示例3: post
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import save [as 别名]
def post(cls, invoices):
Move = Pool().get('account.move')
cls.set_number(invoices)
moves = []
for invoice in invoices:
move = invoice.get_move()
if move != invoice.move:
invoice.move = move
moves.append(move)
if invoice.state != 'posted':
invoice.state = 'posted'
#invoice.state = invoice.update_invoice_status()
if moves:
Move.save(moves)
cls.save(invoices)
Move.post([i.move for i in invoices if i.move.state != 'posted'])