[IMP] sale: display expiry date on quotation portal view
Currently on the portal, when a quotation has a limited validity period, it is expried as "This offers exprires in" Xdays but X is computed always with a additional day and its show "expries in 0 days" so after this commit it shows the expiry date (like This offers expires on 20 december 2020) on portal view instead of X duration. closes odoo/odoo#46649 Task: 2186428 Closes: #46649 Related: odoo/upgrade#874 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
7313e4c7ec
commit
ed3fecb633
@@ -162,7 +162,6 @@ class SaleOrder(models.Model):
|
||||
require_payment = fields.Boolean('Online Payment', default=_get_default_require_payment, readonly=True,
|
||||
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||
help='Request an online payment to the customer in order to confirm orders automatically.')
|
||||
remaining_validity_days = fields.Integer(compute='_compute_remaining_validity_days', string="Remaining Days Before Expiration")
|
||||
create_date = fields.Datetime(string='Creation Date', readonly=True, index=True, help="Date on which sales order is created.")
|
||||
|
||||
user_id = fields.Many2one(
|
||||
@@ -302,13 +301,6 @@ class SaleOrder(models.Model):
|
||||
else:
|
||||
order.expected_date = False
|
||||
|
||||
def _compute_remaining_validity_days(self):
|
||||
for record in self:
|
||||
if record.validity_date:
|
||||
record.remaining_validity_days = (record.validity_date - fields.Date.today()).days + 1
|
||||
else:
|
||||
record.remaining_validity_days = 0
|
||||
|
||||
@api.depends('transaction_ids')
|
||||
def _compute_authorized_transaction_ids(self):
|
||||
for trans in self:
|
||||
|
||||
@@ -153,12 +153,10 @@
|
||||
</li>
|
||||
|
||||
<t t-if="not sale_order.is_expired and sale_order.state in ['draft', 'sent']">
|
||||
<li t-if="sale_order.remaining_validity_days > 0" class="list-group-item">
|
||||
<small><b class="text-muted">This offer expires in</b></small>
|
||||
<div class="day_counter">
|
||||
<i class="fa fa-clock-o" aria-label="Dates" title="Dates"></i>
|
||||
<t t-esc="sale_order.remaining_validity_days"/>
|
||||
<t t-if="sale_order.remaining_validity_days > 1">days</t><t t-else="">day</t>
|
||||
<li t-if="sale_order.validity_date" class="list-group-item">
|
||||
<small><b class="text-muted">This offer expires on</b></small>
|
||||
<div>
|
||||
<t t-esc="sale_order.validity_date.strftime('%d %B %Y')"/>
|
||||
</div>
|
||||
</li>
|
||||
<li t-if="sale_order.amount_undiscounted - sale_order.amount_untaxed > 0.01" class="list-group-item flex-grow-1">
|
||||
|
||||
Reference in New Issue
Block a user