mirror of
https://github.com/bringout/oca-mrp.git
synced 2026-04-23 15:52:05 +02:00
Initial commit: OCA Mrp packages (117 packages)
This commit is contained in:
commit
277e84fd7a
4403 changed files with 395154 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import crm_lead
|
||||
from . import account_analytic_line
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# Copyright 2015 Javier Iniesta <javieria@antiun.com>
|
||||
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountAnalyticLine(models.Model):
|
||||
_inherit = "account.analytic.line"
|
||||
|
||||
lead_id = fields.Many2one(
|
||||
comodel_name="crm.lead",
|
||||
string="Lead/Opportunity",
|
||||
)
|
||||
|
||||
@api.onchange("lead_id")
|
||||
def _onchange_lead_id(self):
|
||||
if self.lead_id.project_id:
|
||||
self.project_id = self.lead_id.project_id.id
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright 2015 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# Copyright 2015 Javier Iniesta <javieria@antiun.com>
|
||||
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class CrmLead(models.Model):
|
||||
_name = "crm.lead"
|
||||
_inherit = ["crm.lead", "hr.timesheet.time_control.mixin"]
|
||||
|
||||
project_id = fields.Many2one(comodel_name="project.project", string="Project")
|
||||
timesheet_ids = fields.One2many(
|
||||
comodel_name="account.analytic.line",
|
||||
inverse_name="lead_id",
|
||||
string="Timesheet",
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _relation_with_timesheet_line(self):
|
||||
return "lead_id"
|
||||
|
||||
@api.depends("timesheet_ids.employee_id", "timesheet_ids.unit_amount")
|
||||
def _compute_show_time_control(self):
|
||||
return super()._compute_show_time_control()
|
||||
|
||||
def button_start_work(self):
|
||||
result = super().button_start_work()
|
||||
result["context"].update({"default_project_id": self.project_id.id})
|
||||
return result
|
||||
Loading…
Add table
Add a link
Reference in a new issue