change lill to validity date when send so

This commit is contained in:
Benoît Vézina 2023-11-07 08:35:29 -05:00
parent 13381f9ffa
commit 57f14f7033
2 changed files with 12 additions and 6 deletions

View file

@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
{
"name": "Update sale quotation date when sent",
"name": "Automatic Quotation Date and Validity Updater",
"version": "15.0.0.0.1",
"category": "Extra Tools",
'summary': 'Update sale quotation date and validity when pressing send button',
'summary': 'Automatically updates the sale quotation date and validity date upon sending the quotation',
"description": """
Update sale quotation date and validity when pressing send button
This module automatically updates the sale quotation date and its validity date upon sending the quotation.
The order date is set to the current date and time, while the validity date is set to 30 days from the current date and time.
This ensures your sale quotations always reflect the most accurate and up-to-date information.
""",
"author": "Bemade",
'website': 'https://www.bemade.org',
@ -17,4 +19,4 @@
"auto_install": False,
"installable": True,
'license': 'OPL-1'
}
}

View file

@ -14,11 +14,15 @@ from odoo.addons.payment import utils as payment_utils
class SaleOrder(models.Model):
_inherit = "sale.order"
_inherit = "sale.order" # SaleOrder model inherits the 'sale.order' object in Odoo
def action_quotation_send(self):
"""This function is executed when the 'Send Quotation' button is clicked."""
# Ensures that the current recordset is exactly one record
self.ensure_one()
# Updates the order date to the current date and time
self.date_order = datetime.now()
# Updates the validity date to 30 days from now
self.validity_date = datetime.now() + timedelta(days=30)
# Calls the original 'action_quotation_send' method from 'sale.order'
super(SaleOrder, self).action_quotation_send()