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


Python Pool.quote方法代码示例

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


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

示例1: process_state_using_ps_data

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def process_state_using_ps_data(self, order_state):
        """Process Sale state as per the current state

        :param order_state: Site order state corresponding to ps order state
        """
        Sale = Pool().get('sale.sale')

        # Do not process sale if sale has exception
        if self.has_channel_exception:
            return

        self.channel.get_prestashop_client()

        # Cancel the order if its cancelled on prestashop
        if order_state.order_state == 'sale.cancel':
            Sale.cancel([self])
            return

        # Confirm and process the order in any other case
        Sale.quote([self])
        Sale.confirm([self])

        if order_state.order_state != 'sale.confirmed':
            # XXX: To mark sale as Done, sale must be in Processing state
            # as marking sale as Done is part of transition workflow now,
            # which allows only processed sale to be marked as Done.
            # But not sure if calling proceed before process is the right
            # way to do.
            Sale.proceed([self])
            Sale.process([self])
开发者ID:openlabs,项目名称:trytond-prestashop,代码行数:32,代码来源:sale.py

示例2: process_to_channel_state

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def process_to_channel_state(self, channel_state):
        """
        Process the sale in tryton based on the state of order
        when its imported from channel

        :param channel_state: State on external channel the order was imported
        """
        Sale = Pool().get('sale.sale')
        Shipment = Pool().get('stock.shipment.out')

        data = self.channel.get_tryton_action(channel_state)

        if data['action'] in ['process_manually', 'process_automatically']:
            Sale.quote([self])
            Sale.confirm([self])

        if data['action'] == 'process_automatically':
            Sale.process([self])
            for shipment in self.shipments:
                if shipment.state == 'draft':
                    Shipment.wait([shipment])
                if shipment.state == 'waiting':
                    Shipment.assign_try([shipment])

        if data['action'] == 'import_as_past':
            # XXX: mark past orders as completed
            self.state = 'done'
            self.save()
开发者ID:bhavana94,项目名称:trytond-sale-channel,代码行数:30,代码来源:sale.py

示例3: checkout

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def checkout(self):
        '''Submit of default checkout

        A GET to the method will result in passing of control to begin as
        that is basically the entry point to the checkout

        A POST to the method will result in the confirmation of the order and
        subsequent handling of data.
        '''
        cart_obj = Pool().get('nereid.cart')
        sale_obj = Pool().get('sale.sale')

        cart = cart_obj.open_cart()
        if not cart.sale:
            # This case is possible if the user changes his currency at
            # the point of checkout and the cart gets cleared.
            return redirect(url_for('nereid.cart.view_cart'))

        sale = cart.sale
        if not sale.lines:
            flash(_("Add some items to your cart before you checkout!"))
            return redirect(url_for('nereid.website.home'))
        if request.method == 'GET':
            return (self._begin_guest() if request.is_guest_user \
                else self._begin_registered())

        elif request.method == 'POST':
            form, do_process = self._submit_guest() if request.is_guest_user \
                else self._submit_registered()
            if do_process:
                # Process Shipping
                self._process_shipment(sale, form)

                # Process Payment, if the returned value from the payment
                # is a response object (isinstance) then return that instead
                # of the success page. This will allow reidrects to a third 
                # party gateway or service to collect payment.
                response = self._process_payment(sale, form)
                if isinstance(response, BaseResponse):
                    return response

                if sale.state == 'draft':
                    # Ensure that the order date is that of today
                    cart_obj.check_update_date(cart)
                    # Confirm the order
                    sale_obj.quote([sale.id])
                    sale_obj.confirm([sale.id])

                flash(_("Your order #%(sale)s has been processed", sale=sale.reference))
                if request.is_guest_user:
                    return redirect(url_for('nereid.website.home'))
                else:
                    return redirect(
                        url_for(
                            'sale.sale.render', sale=sale.id, 
                            confirmation=True
                        )
                    )

            return render_template('checkout.jinja', form=form, cart=cart)
开发者ID:shalabhaggarwal,项目名称:nereid-checkout,代码行数:62,代码来源:checkout.py

示例4: process_sale_using_magento_state

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def process_sale_using_magento_state(self, magento_state):
        """
        Process the sale in tryton based on the state of order
        when its imported from magento

        :param magento_state: State on magento the order was imported in
        """
        Sale = Pool().get('sale.sale')

        data = self.channel.get_tryton_action(magento_state)

        if data['action'] in ['process_manually', 'process_automatically']:
            Sale.quote([self])
            Sale.confirm([self])

        if data['action'] == 'process_automatically':
            Sale.process([self])
开发者ID:priyankarani,项目名称:trytond-magento,代码行数:19,代码来源:sale.py

示例5: process_fba_order

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def process_fba_order(self):
        """
        Process FBA Orders as they are imported as past orders
        and handle their shipments.
        """
        Sale = Pool().get('sale.sale')
        Shipment = Pool().get('stock.shipment.out')

        Sale.quote([self])
        Sale.confirm([self])
        Sale.process([self])

        for shipment in self.shipments:
            if shipment.state == 'draft':
                Shipment.wait([shipment])
            if shipment.state == 'waiting':
                Shipment.assign([shipment])
            if shipment.state == 'assigned':
                Shipment.pack([shipment])
            if shipment.state == 'packed':
                Shipment.done([shipment])
开发者ID:Jason-Kou,项目名称:trytond-amazon-mws,代码行数:23,代码来源:sale.py

示例6: process_sale_using_magento_state

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def process_sale_using_magento_state(self, magento_state):
        """
        Process the sale in tryton based on the state of order
        when its imported from magento

        :param magento_state: State on magento the order was imported in
        """
        Sale = Pool().get('sale.sale')

        data = MagentoOrderState.get_tryton_state(magento_state)

        # If order is canceled, just cancel it
        if data['tryton_state'] == 'sale.cancel':
            Sale.cancel([self])
            return

        # Order is not canceled, move it to quotation
        Sale.quote([self])
        Sale.confirm([self])

        if data['tryton_state'] not in ['sale.quotation', 'sale.confirmed']:
            Sale.process([self])
开发者ID:GauravButola,项目名称:trytond-magento,代码行数:24,代码来源:sale.py

示例7: confirm_cart

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def confirm_cart(cls, cart):
        '''
        Confirm the sale, clear the sale from the cart
        '''
        Sale = Pool().get('sale.sale')

        sale = cart.sale
        Sale.quote([cart.sale])
        Sale.confirm([cart.sale])

        cart.sale = None
        cart.save()

        # Redirect to the order confirmation page
        flash(_(
            "Your order #%(sale)s has been processed",
            sale=sale.reference
        ))

        return redirect(url_for(
            'sale.sale.render', active_id=sale.id, confirmation=True,
            access_code=sale.guest_access_code,
        ))
开发者ID:priyankarani,项目名称:nereid-checkout,代码行数:25,代码来源:checkout.py

示例8: model_copy

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import quote [as 别名]
    def model_copy(cls, subscription_id):
        Cron = Pool().get('ir.cron')
        History = Pool().get('training.subscription.history')
        Invoice = Pool().get('account.invoice')
        Sale = Pool().get('sale.sale')
        SaleInvoice = Pool().get('sale.sale-account.invoice')
        
        subscription = cls(subscription_id)
        logger = logging.getLogger('training_subscription')
        number_calls = subscription.number_calls
        remaining = Cron.browse([subscription.cron.id])[0].number_calls
        actual = number_calls - remaining + 1
        model_id = subscription.model_source and subscription.model_source.id \
                or False
        if model_id:
            Model = Pool().get(subscription.model_source.__name__)
            default = {'state':'draft'}
            #default['subscription_code'] = subscription.model_source.subscription_code + ' ' +str(actual)
            default['subscription_code'] = subscription.model_source.subscription_code

            try:
                model = Model.copy([subscription.model_source], default)
            except:
                history_vals = {
                    'log': cls.raise_user_error(
                        error='error_creating',
                        error_args=subscription.model_source.__name__, 
                        raise_exception=False)
                }
            else:
                history_vals = {
                    'log': cls.raise_user_error(
                        error='created_successfully',
                        error_args=subscription.model_source.__name__, 
                        raise_exception=False)
                }
                history_vals['document'] = (subscription.model_source.__name__,
                                        model[0].id)
            History.create([history_vals])
            
            sales = Sale.search([
                         ('id','=',model[0].id)
                         ])
            
            for sale in sales:
                Sale.quote([sale])
                Sale.confirm([sale])
                Sale.process([sale])
                
                saleinvoices = SaleInvoice.search([
                    ('sale', '=', sale.id),
                    ])
                invoices = Invoice.search( [
                    ('id','=',saleinvoices[0].invoice.id)
                    ])
                Invoice.write(invoices, {
                    'reference': sale.subscription_code,
                    'invoice_date': sale.sale_date,
                    })
                Invoice.post(invoices)
                
                if invoices:
                    for invoice in invoices:
                        cls.write([subscription], 
                                           {'sales': [('add', [sale.id])],
                                           'invoices': [('add', [invoice.id])]
                                               })

            # If it is the last cron execution, set the state of the
            # subscription to done
            if remaining == 1:
                subscription.write([subscription], {'state': 'done'})
        else:
            logger.error('Document in subscription %s not found.\n' % \
                         subscription.code)   
开发者ID:iehoshia,项目名称:trytond-training_subscription,代码行数:77,代码来源:training.py


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