mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-25 05:12:07 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
48
odoo-bringout-oca-ocb-product/product/controllers/catalog.py
Normal file
48
odoo-bringout-oca-ocb-product/product/controllers/catalog.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.http import request, route, Controller
|
||||
|
||||
|
||||
class ProductCatalogController(Controller):
|
||||
|
||||
@route('/product/catalog/order_lines_info', auth='user', type='jsonrpc', readonly=True)
|
||||
def product_catalog_get_order_lines_info(self, res_model, order_id, product_ids, **kwargs):
|
||||
""" Returns products information to be shown in the catalog.
|
||||
|
||||
:param string res_model: The order model.
|
||||
:param int order_id: The order id.
|
||||
:param list product_ids: The products currently displayed in the product catalog, as a list
|
||||
of `product.product` ids.
|
||||
:rtype: dict
|
||||
:return: A dict with the following structure:
|
||||
{
|
||||
product.id: {
|
||||
'productId': int
|
||||
'quantity': float (optional)
|
||||
'price': float
|
||||
'uomDisplayName': string
|
||||
'code': string (optional)
|
||||
'readOnly': bool (optional)
|
||||
}
|
||||
}
|
||||
"""
|
||||
order = request.env[res_model].browse(order_id)
|
||||
return order.with_company(order.company_id)._get_product_catalog_order_line_info(
|
||||
product_ids, **kwargs,
|
||||
)
|
||||
|
||||
@route('/product/catalog/update_order_line_info', auth='user', type='jsonrpc')
|
||||
def product_catalog_update_order_line_info(self, res_model, order_id, product_id, quantity=0, **kwargs):
|
||||
""" Update order line information on a given order for a given product.
|
||||
|
||||
:param string res_model: The order model.
|
||||
:param int order_id: The order id.
|
||||
:param int product_id: The product, as a `product.product` id.
|
||||
:return: The unit price price of the product, based on the pricelist of the order and
|
||||
the quantity selected.
|
||||
:rtype: float
|
||||
"""
|
||||
order = request.env[res_model].browse(order_id)
|
||||
return order.with_company(order.company_id)._update_order_line_info(
|
||||
product_id, quantity, **kwargs,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue