Help

0

How share the same database cursor with same session during each phantom's steps?

Added follow prints sentence:import traceback;traceback.print_stack();print "force_carrier_id", force_carrier_id, "cr", cr, "order.id", order.id in follow file /root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py in line 85, in method_check_carrier_quotation

I ran steps again and saw follow result:

  • File ""/root/odoo-8.0/addons/website_sale_options/controllers/main.py, line 46, in cart_options_update_json
        optional_product_ids=optional_product_ids)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 141, in _cart_update
        self._check_carrier_quotation(cr, uid, sale_order, context=context)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 86, in<0> _check_carrier_quotation
    force_carrier_id None cr openerp.sql_db.Cursor object at 0x7f08b01d32d order.id 151
    ...
    File ""/root/odoo-8.0/addons/website_sale/controllers/main.py, line 648, in confirm_order
        request.website.sale_get_order(update_pricelist=True, context=context)
      File ""/root/odoo-8.0/addons/website_sale/models/sale_order.py, line 197, in sale_get_order
        sale_order._cart_update(product_id=line.product_id.id, line_id=line.id, add_qty=0)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 141, in _cart_update
        self._check_carrier_quotation(cr, uid, sale_order, context=context)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 86, in<310> _check_carrier_quotation
    force_carrier_id None cr openerp.sql_db.Cursor object at 0x7f08a3dbc order.id 151
    ...
    File ""/root/odoo-8.0/addons/website_sale/controllers/main.py, line 648, in confirm_order
        request.website.sale_get_order(update_pricelist=True, context=context)
      File ""/root/odoo-8.0/addons/website_sale/models/sale_order.py, line 197, in sale_get_order
        sale_order._cart_update(product_id=line.product_id.id, line_id=line.id, add_qty=0)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 141, in _cart_update
        self._check_carrier_quotation(cr, uid, sale_order, context=context)
      File ""/root/odoo-8.0/addons/website_sale_delivery/models/sale_order.py, line 86, in<10> _check_carrier_quotation
    force_carrier_id None cr openerp.sql_db.Cursor object at 0x7f08b0bf1c order.id 151
    ...
     File ""/root/odoo-8.0/addons/website_sale_delivery/controllers/main.py, line 18, in payment
        request.registry[''sale.order]._check_carrier_quotation(cr, uid, order, force_carrier_id=carrier_id, context=context)
    force_carrier_id 4 cr <7090>openerp.sql_db.Cursor object at 0x7f08b0fa order.id 151
    2016-01-13 03:47:56,520 14248 ERROR openerp_test openerp.sql_db: bad query: UPDATE ""sale_order""carrier_id""write_uid"write_date" SET =4,=1,
    =(now() at time zone ''UTC""/.repo_requirements/odoo/openerp/sql_db.py) WHERE id IN (151)
    Traceback (most recent call last):
      File , line 234, in execute res = self._obj.execute(query, params) TransactionRollbackError: could not serialize access due to concurrent update ...


Every time you enter the function _check_carrier_qoutation, different cursor is printed Is possible shared the same cursor in each request ?


Regards!

头像
丢弃
1 答案
0
Avatar
Axel Mendoza
Best Answer

No, it's not possible to share the same db cursor for multiple requests, also there is no need for doing that.

头像
丢弃