本文整理汇总了Python中trytond.pool.Pool.create_from_records方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.create_from_records方法的具体用法?Python Pool.create_from_records怎么用?Python Pool.create_from_records使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trytond.pool.Pool
的用法示例。
在下文中一共展示了Pool.create_from_records方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import create_from_records [as 别名]
def write(cls, products, values, *args):
"""Create a record in elastic search on write
"""
IndexBacklog = Pool().get('elasticsearch.index_backlog')
rv = super(Product, cls).write(products, values, *args)
IndexBacklog.create_from_records(products)
return rv
示例2: create
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import create_from_records [as 别名]
def create(cls, vlist):
"""Create a record in elastic search on create
:param vlist: List of dictionaries of fields with values
"""
IndexBacklog = Pool().get('elasticsearch.index_backlog')
products = super(Product, cls).create(vlist)
IndexBacklog.create_from_records(products)
return products
示例3: write
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import create_from_records [as 别名]
def write(cls, templates, values, *args):
"""
Create a record in elastic search on write
"""
IndexBacklog = Pool().get('elasticsearch.index_backlog')
Product = Pool().get('product.product')
rv = super(Template, cls).write(templates, values, *args)
products = []
for template in templates:
products.extend([Product(p) for p in template.products])
IndexBacklog.create_from_records(products)
return rv
示例4: create
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import create_from_records [as 别名]
def create(cls, vlist):
"""
Create a record in elastic search on create
:param vlist: List of dictionaries of fields with values
"""
IndexBacklog = Pool().get('elasticsearch.index_backlog')
Product = Pool().get('product.product')
templates = super(Template, cls).create(vlist)
products = []
for template in templates:
products.extend([Product(p) for p in template.products])
IndexBacklog.create_from_records(products)
return templates
示例5: _trigger_handler
# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import create_from_records [as 别名]
def _trigger_handler(cls, records, trigger):
"Handler called by trigger"
IndexBacklog = Pool().get('elasticsearch.index_backlog')
return IndexBacklog.create_from_records(records)