mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][IMP] contract_sale_generation
Use the generation_type field defined now in contract base module. Improve tests
This commit is contained in:
committed by
ntsirintanis
parent
28085a6e19
commit
ae3aaa8f13
24
contract_sale_generation/models/sale_order.py
Normal file
24
contract_sale_generation/models/sale_order.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2021 ACSONE SA/NV (<http://acsone.eu>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
contract_auto_confirm = fields.Boolean(
|
||||
compute="_compute_contract_auto_confirm",
|
||||
help="This is a technical field in order to know if the order should"
|
||||
"be automatically confirmed if generated by contract.",
|
||||
)
|
||||
|
||||
def _compute_contract_auto_confirm(self):
|
||||
sale_auto_confirm = self.filtered(
|
||||
lambda sale: any(
|
||||
line.contract_line_id.contract_id.sale_autoconfirm
|
||||
for line in sale.order_line
|
||||
)
|
||||
)
|
||||
sale_auto_confirm.contract_auto_confirm = True
|
||||
(self - sale_auto_confirm).contract_auto_confirm = False
|
||||
Reference in New Issue
Block a user