[IMP] mrp_project_link/mrp_operations_project/mrp_project_link_mto: Refactorization + integration in one module

This commit is contained in:
Pedro M. Baeza
2015-11-20 23:42:48 +01:00
committed by Oihane Crucelaegui
parent 63dc1aa587
commit 1cef0f20d9
3 changed files with 0 additions and 49 deletions

View File

@@ -18,5 +18,4 @@
from . import account_analytic_line
from . import mrp_production
from . import product
from . import project_project
from . import mrp_bom

View File

@@ -86,7 +86,6 @@ class MrpProduction(models.Model):
cond = [('mrp_production_id', '=', production.id)]
analytic_line_obj.search(cond).unlink()
if production.project_id.automatic_creation:
production.project_id.unlink()
analytic_lines = analytic_line_obj.search(
[('account_id', '=', production.analytic_account_id.id)])
if not analytic_lines:
@@ -99,27 +98,6 @@ class MrpProduction(models.Model):
self.calculate_production_estimated_cost()
return res
@api.multi
def action_compute(self, properties=None):
project_obj = self.env['project.project']
res = super(MrpProduction, self).action_compute(properties=properties)
for record in self:
if not record.project_id:
project = project_obj.search([('name', '=', record.name)],
limit=1)
if not project:
project_vals = {
'name': record.name,
'use_tasks': True,
'use_timesheets': True,
'use_issues': True,
'automatic_creation': True,
}
project = project_obj.create(project_vals)
record.project_id = project.id
record.analytic_account_id = project.analytic_account_id.id
return res
@api.multi
def action_show_estimated_costs(self):
self.ensure_one()

View File

@@ -1,26 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
##############################################################################
from openerp import models, fields
class ProjectProject(models.Model):
_inherit = 'project.project'
automatic_creation = fields.Boolean('Automatic Creation')