当前位置: 首页>>代码示例>>Python>>正文


Python Pool.save方法代码示例

本文整理汇总了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)
开发者ID:tryton-ar,项目名称:contract_discount,代码行数:13,代码来源:contract.py

示例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)
开发者ID:kret0s,项目名称:gnuhealth-live,代码行数:19,代码来源:inventory.py

示例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'])
开发者ID:iehoshia,项目名称:training_iesa,代码行数:19,代码来源:account.py


注:本文中的trytond.pool.Pool.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。