| 1 |
# Part of Odoo. See LICENSE file for full copyright and licensing details. |
| 2 |
|
| 3 |
from odoo import fields, models |
| 4 |
|
| 5 |
|
| 6 |
class ResConfigSettings(models.TransientModel): |
| 7 |
_inherit = 'res.config.settings' |
| 8 |
|
| 9 |
group_sale_order_template = fields.Boolean( |
| 10 |
"Quotation Templates", implied_group='sale_management.group_sale_order_template') |
| 11 |
company_so_template_id = fields.Many2one( |
| 12 |
related="company_id.sale_order_template_id", string="Default Template", readonly=False, |
| 13 |
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]") |
| 14 |
|
| 15 |
def set_values(self): |
| 16 |
if not self.group_sale_order_template: |
| 17 |
if self.company_so_template_id: |
| 18 |
self.company_so_template_id = False |
| 19 |
companies = self.env['res.company'].sudo().search([ |
| 20 |
('sale_order_template_id', '!=', False) |
| 21 |
]) |
| 22 |
if companies: |
| 23 |
companies.sale_order_template_id = False |
| 24 |
super().set_values() |