diff --git a/bemade_update_validity_date_when_send_so/__manifest__.py b/bemade_update_validity_date_when_send_so/__manifest__.py index fd56a6b..697cfbc 100644 --- a/bemade_update_validity_date_when_send_so/__manifest__.py +++ b/bemade_update_validity_date_when_send_so/__manifest__.py @@ -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' -} +} \ No newline at end of file diff --git a/bemade_update_validity_date_when_send_so/models/sale_order.py b/bemade_update_validity_date_when_send_so/models/sale_order.py index 0063249..1637dd2 100644 --- a/bemade_update_validity_date_when_send_so/models/sale_order.py +++ b/bemade_update_validity_date_when_send_so/models/sale_order.py @@ -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() -