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


Python Pool.delete方法代码示例

本文整理汇总了Python中trytond.pool.Pool.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.delete方法的具体用法?Python Pool.delete怎么用?Python Pool.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trytond.pool.Pool的用法示例。


在下文中一共展示了Pool.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, registrations):
        Event = Pool().get('calendar.event')

        for inpatient_registration in registrations:
            if inpatient_registration.event:
                Event.delete([inpatient_registration.event])
        return super(InpatientRegistration, cls).delete(registrations)
开发者ID:Sisouvan,项目名称:ogh,代码行数:9,代码来源:health_inpatient_calendar.py

示例2: round_down_total

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def round_down_total(cls, records):
        '''
        Round down total order price and add remaining amount as new sale line
        '''
        SaleLine = Pool().get('sale.line')

        sale_lines = []
        for record in records:
            # Check if there's already a roundoff line, remove and create new
            # if there is.
            round_off_line = SaleLine.search([
                ('sale', '=', record.id),
                ('is_round_off', '=', True),
            ])
            if round_off_line:
                SaleLine.delete(round_off_line)

            floored_total = floor(record.total_amount)
            amount_diff = record.total_amount - Decimal(floored_total)
            sale_lines.append({
                'sale': record,
                'is_round_off': True,
                'type': 'line',
                'quantity': -1,
                'unit_price': amount_diff,
                'description': 'Round Off'
            })

        SaleLine.create(
            [line for line in sale_lines if line['unit_price']]
        )
开发者ID:rajatguptarg,项目名称:trytond-pos,代码行数:33,代码来源:sale.py

示例3: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, document_types):
        "Delete records and remove associated triggers"
        Trigger = Pool().get('ir.trigger')

        triggers_to_delete = [dt.trigger for dt in document_types]
        super(DocumentType, cls).delete(document_types)
        Trigger.delete(triggers_to_delete)
开发者ID:PritishC,项目名称:trytond-elastic-search,代码行数:9,代码来源:index.py

示例4: cancel_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
 def cancel_move(cls, lines):
     Move = Pool().get('stock.move')
     Move.cancel([l.move for l in lines if l.move])
     Move.delete([l.move for l in lines if l.move])
     cls.write([l for l in lines if l.move], {
         'move': None,
         })
开发者ID:ferjavrec,项目名称:stock,代码行数:9,代码来源:inventory.py

示例5: set_shares

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def set_shares(self, ids, name, value):
        share_obj = Pool().get('webdav.share')

        if not value:
            return

        attachments = self.browse(ids)
        for action in value:
            if action[0] == 'create':
                for attachment in attachments:
                    action[1]['path'] = attachment.path
                    share_obj.create(action[1])
            elif action[0] == 'write':
                share_obj.write(action[1], action[2])
            elif action[0] == 'delete':
                share_obj.delete(action[1])
            elif action[0] == 'delete_all':
                paths = [a.path for a in attachments]
                share_ids = share_obj.search([
                        ('path', 'in', paths),
                        ])
                share_obj.delete(share_ids)
            elif action[0] == 'unlink':
                pass
            elif action[0] == 'add':
                pass
            elif action[0] == 'unlink_all':
                pass
            elif action[0] == 'set':
                pass
            else:
                raise Exception('Bad arguments')
开发者ID:mediafactory,项目名称:tryton_core_daemon,代码行数:34,代码来源:webdav.py

示例6: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, appointments):
        Event = Pool().get('calendar.event')

        for appointment in appointments:
            if appointment.event:
                Event.delete([appointment.event])
        return super(Appointment, cls).delete(appointments)
开发者ID:GabrielReusRodriguez,项目名称:gnuhealth,代码行数:9,代码来源:health_calendar.py

示例7: element

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
def element(model, record_id):
    """
    GET: Retrieve a representation of the member
    PUT: Write to the record
    DELETE: Delete the record

    :param model: name of the model
    :param record_id: ID of the record
    """
    model = Pool().get(model, type='model')
    record = model(record_id)

    if request.method == 'GET':
        # Return a dictionary of the read record
        fields_names = request.args.getlist('fields_names')
        return jsonify(
            model.read([record.id], fields_names)[0]
        )

    elif request.method == 'PUT':
        # Write to the record and return the updated record
        model.write([record], request.json)
        fields_names = request.args.getlist('fields_names')
        return jsonify(
            model.read([record.id], fields_names)[0]
        )

    elif request.method == 'DELETE':
        model.delete([record])
        return jsonify({}), 205
开发者ID:GauravButola,项目名称:tryton-restful,代码行数:32,代码来源:application.py

示例8: delete_from_cart

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete_from_cart(cls, line):
        """
        Delete a line from the cart. The required argument in POST is:

            line_id : ID of the line

        Response: 'OK' if X-HTTPRequest else redirect to shopping cart
        """
        SaleLine = Pool().get('sale.line')

        cart = cls.open_cart()
        if not cart.sale:
            abort(404)

        try:
            sale_line, = SaleLine.search([
                ('id', '=', line),
                ('sale', '=', cart.sale.id),
            ])
        except ValueError:
            message = 'Looks like the item is already deleted.'
        else:
            SaleLine.delete([sale_line])
            message = 'The order item has been successfully removed.'

        flash(_(message))

        if request.is_xhr:
            return jsonify(message=message)

        return redirect(url_for('nereid.cart.view_cart'))
开发者ID:2cadz,项目名称:nereid-cart-b2c,代码行数:33,代码来源:cart.py

示例9: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, records):
        Event = Pool().get('calendar.event')

        for record in records:
            if record.event:
                Event.delete([record.event_id])
        return super(TransportRequest, cls).delete(records)
开发者ID:geneos,项目名称:policoop_ems,代码行数:9,代码来源:policoop_ems.py

示例10: _borrar_productos_temporales

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
 def _borrar_productos_temporales(self, id_wizard_start='0'):
     CalcularPapelProducto = Pool().get('sale_printery_budget.calcular_papel.producto')
     productos_a_borrar = CalcularPapelProducto.search([('id_wizard', '=',
                                                    id_wizard_start)])
     with Transaction().new_transaction() as transaction:
         CalcularPapelProducto.delete(productos_a_borrar)
         transaction.commit()
开发者ID:gcoop-libre,项目名称:sale_printery_budget,代码行数:9,代码来源:sale.py

示例11: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, project_works):
        TimesheetWork = Pool().get('timesheet.work')

        # Get the timesheet works linked to the project works
        timesheet_works = [pw.work for pw in project_works]

        super(Work, cls).delete(project_works)

        TimesheetWork.delete(timesheet_works)
开发者ID:silpol,项目名称:tryton-bef,代码行数:11,代码来源:work.py

示例12: clear_lines

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def clear_lines(cls, assets):
        Line = Pool().get('account.asset.line')

        lines_to_delete = []
        for asset in assets:
            for line in asset.lines:
                if not line.move or line.move.state != 'posted':
                    lines_to_delete.append(line)
        Line.delete(lines_to_delete)
开发者ID:silpol,项目名称:tryton-bef,代码行数:11,代码来源:asset.py

示例13: cancelada

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
 def cancelada(cls, publ):
     line = Pool().get('sale.line')
     for p in publ:
         try:
             linea = p.linea
             p.linea=None
             p.save()
             line.delete([linea])
         except:
             pass
开发者ID:lucianoit10,项目名称:tryton_el_independiente,代码行数:12,代码来源:edicion.py

示例14: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, lines):
        Selection = Pool().get('analytic_account.account.selection')

        selections = []
        for line in lines:
            if line.analytic_accounts:
                selections.append(line.analytic_accounts)

        super(SaleLine, cls).delete(lines)
        Selection.delete(selections)
开发者ID:aleibrecht,项目名称:tryton-modules-ar,代码行数:12,代码来源:sale.py

示例15: delete

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import delete [as 别名]
    def delete(cls, lines):
        Selection = Pool().get('analytic_account.account.selection')

        selection_ids = []
        for line in lines:
            if line.analytic_accounts:
                selection_ids.append(line.analytic_accounts.id)

        super(InvoiceLine, cls).delete(lines)
        Selection.delete(Selection.browse(selection_ids))
开发者ID:silpol,项目名称:tryton-bef,代码行数:12,代码来源:invoice.py


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