[IMP] sale: hide "Sign & Pay" button for expired draft quotations

Previously, draft quotations were never marked as expired. However, draft quotations can be viewed in the portal if you have the link. In order to prevent customers from paying for draft quotations, we now mark draft quotations as expired when applicable.

task-3577657

closes odoo/odoo#144581

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Louis (loti)
2023-12-18 14:34:15 +00:00
committed by Victor Feyens
parent 078903948f
commit 7e14f920da
+5 -1
View File
@@ -593,7 +593,11 @@ class SaleOrder(models.Model):
def _compute_is_expired(self):
today = fields.Date.today()
for order in self:
order.is_expired = order.state == 'sent' and order.validity_date and order.validity_date < today
order.is_expired = (
order.state in ('draft', 'sent')
and order.validity_date
and order.validity_date < today
)
@api.depends('company_id', 'fiscal_position_id')
def _compute_tax_country_id(self):