Now I am extending the new field (boolean) to the object, sale.order.
My default value of extended field is False.
Extending part is ok and I already added this field to tree, form view.
So my original idea is when user press "add to cart" button in webshop, my new extended field automatically assign true (boolean) value. In Odoo, adding cart is like creating new Quotation in back-end if Quotation haven't created yet.
Here is my extended field:
from odoo import api, fields, models class add_to_cart_extend(models.Model): _inherit = 'sale.order' is_value_over = fields.Boolean(string='value_over')
I just realized that I needed to assign this value in two main functions under website_sale module, as below:
@http.route(['/shop/cart'], type='http', auth="public", website=True) def cart(self, **post): @http.route(['/shop/cart/update'], type='http', auth="public", methods=['POST'], website=True, csrf=False) def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
How can I assign is_value_over value to true when user is adding item to the cart?