1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/website_sale_renting/models/sale_order_line.py
2024-12-10 09:04:09 +07:00

29 lines
865 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.http import request
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
def _get_rental_pricing_description(self):
self.ensure_one()
order = self.order_id
pricing = self.product_id._get_best_pricing_rule(
start_date=order.rental_start_date,
end_date=order.rental_return_date,
pricelist=order.pricelist_id,
company=order.company_id,
currency=order.currency_id,
)
return pricing.description
def _get_tz(self):
return request and request.httprequest.cookies.get('tz') or super()._get_tz()
def _is_reorder_allowed(self):
if self.is_rental:
return False
return super()._is_reorder_allowed()