diff --git a/separate_quotation_number_odoo/__manifest__.py b/separate_quotation_number_odoo/__manifest__.py index 34e630879..1bcf0f516 100644 --- a/separate_quotation_number_odoo/__manifest__.py +++ b/separate_quotation_number_odoo/__manifest__.py @@ -22,16 +22,15 @@ { 'name': 'Separate Quotation Number', 'version': '16.0.1.0.0', - 'summary': 'Separate Quotation Number', - 'sequence': 4, - 'description': """Separate sequence number for sales quotation and sale - orders. This is used to separate sales quotation and sale orders.""", 'category': 'Sales', + 'summary': 'Separate Quotation Number', + 'description': """Separate sequence number for sales quotation and sale orders. + This is used to separate sales quotation and sale orders.""", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions', 'website': 'https://www.cybrosys.com', - 'license': 'LGPL-3', + 'images': ['static/description/banner.png'], 'depends': [ 'base', 'sale_management', @@ -41,7 +40,7 @@ 'data/ir_sequence_data.xml', 'views/sale_order_views.xml' ], - 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', 'installable': True, 'application': False, 'auto_install': False, diff --git a/separate_quotation_number_odoo/doc/RELEASE_NOTES.md b/separate_quotation_number_odoo/doc/RELEASE_NOTES.md index 19be002f0..5cf32acf0 100644 --- a/separate_quotation_number_odoo/doc/RELEASE_NOTES.md +++ b/separate_quotation_number_odoo/doc/RELEASE_NOTES.md @@ -5,3 +5,7 @@ #### ADD - Initial commit for separate_quotation_number_odoo +#### 24.07.2023 +#### Version 16.0.1.0.1 +#### FIX +- Fixed the @api.model decorator issue \ No newline at end of file diff --git a/separate_quotation_number_odoo/models/sale_order.py b/separate_quotation_number_odoo/models/sale_order.py index a4f6ae738..4cd9a0b91 100644 --- a/separate_quotation_number_odoo/models/sale_order.py +++ b/separate_quotation_number_odoo/models/sale_order.py @@ -23,17 +23,34 @@ from odoo import models, fields, api class SaleOrder(models.Model): + """ + This class extends the default 'sale.order' model to include an additional + field called 'quotation_ref', which holds an auto-generated reference + number for the quotation. + """ _inherit = 'sale.order' quotation_ref = fields.Char(string='Quotation Reference', - copy=False, readonly=True, tracking=True) + copy=False, readonly=True, tracking=True, + help="Auto-generated reference number") - @api.model + @api.model_create_multi def create(self, vals): - """Method for generating sequence for quotation """ + """ + Create Sale Orders and generate sequence numbers for quotations. + This method is called when creating multiple sale orders at once. + Generates a unique sequence number for each sale order's 'quotation_ref' + field using the 'seq_quotation'. + + :param vals_list: A list of dictionaries containing values for creating + multiple sale orders. + :type vals_list: list(dict) + :return: The created sale orders. + """ res = super(SaleOrder, self).create(vals) - seq_val = self.env.ref( - 'separate_quotation_number_odoo.seq_quotation').id - res.quotation_ref = self.env['ir.sequence'].browse( - seq_val).next_by_id() + for vals in res: + seq_val = self.env.ref( + 'separate_quotation_number_odoo.seq_quotation').id + vals.quotation_ref = self.env['ir.sequence'].browse( + seq_val).next_by_id() return res diff --git a/separate_quotation_number_odoo/static/description/index.html b/separate_quotation_number_odoo/static/description/index.html index ae4e41fc0..a75528162 100644 --- a/separate_quotation_number_odoo/static/description/index.html +++ b/separate_quotation_number_odoo/static/description/index.html @@ -38,10 +38,7 @@ - - -