ai*
This commit is contained in:
4
ai_documents_account/models/__init__.py
Normal file
4
ai_documents_account/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import documents_document
|
||||
from . import ir_actions_server
|
||||
18
ai_documents_account/models/documents_document.py
Normal file
18
ai_documents_account/models/documents_document.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class DocumentsDocument(models.Model):
|
||||
_inherit = "documents.document"
|
||||
|
||||
ai_document_or_env_company_id = fields.Many2one(
|
||||
"res.company",
|
||||
string="AI Company",
|
||||
compute="_compute_ai_document_or_env_company_id",
|
||||
)
|
||||
|
||||
@api.depends("company_id")
|
||||
def _compute_ai_document_or_env_company_id(self):
|
||||
for document in self:
|
||||
document.ai_document_or_env_company_id = document.company_id or self.env.company
|
||||
13
ai_documents_account/models/ir_actions_server.py
Normal file
13
ai_documents_account/models/ir_actions_server.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class IrActionsServer(models.Model):
|
||||
_inherit = "ir.actions.server"
|
||||
|
||||
@api.depends("state", "child_ids", "evaluation_type")
|
||||
def _compute_ai_tool_is_candidate(self):
|
||||
account_actions = self.filtered(lambda a: a.state == "documents_account_record_create")
|
||||
account_actions.ai_tool_is_candidate = True
|
||||
super(IrActionsServer, self - account_actions)._compute_ai_tool_is_candidate()
|
||||
Reference in New Issue
Block a user