Tower: upload tk_construction_management 18.0.2.0.8 (was 18.0.2.0.8, via marketplace)

This commit is contained in:
2026-05-08 19:20:12 +00:00
parent c412640ca2
commit 63c62699f5
174 changed files with 44759 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
from odoo import api, fields, models, _
class BudgetConstruction(models.TransientModel):
_name = 'budget.construction'
_description = "Budget Construction"
name = fields.Char(string="Title")
responsible_id = fields.Many2one('res.users', default=lambda self: self.env.user and self.env.user.id or False,
string="Responsible")
def action_create_sub_project_budget(self):
active_id = self._context.get('active_id')
project_id = self.env['tk.construction.project'].browse(active_id)
if not project_id.boq_budget_ids:
message = {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'type': 'info',
'message': "Please add BOQ Line to create Budget.",
'sticky': False,
}
}
return message
budget_id = self.env['sub.project.budget'].create({
'name': self.name,
'responsible_id': self.responsible_id.id,
'site_id': project_id.construction_site_id.id,
'sub_project_id': project_id.id,
'start_date': project_id.start_date,
'end_date': project_id.end_date
})
project_id.budget_id = budget_id.id
for data in project_id.boq_budget_ids:
self.env['project.budget'].create({
'sub_project_budget_id': budget_id.id,
'job_type_id': data.activity_id.id,
'sub_category_id': data.sub_activity_id.id,
'boq_qty': data.total_qty,
})