mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
Merge pull request #85 from ddico/submit_add_timesheet_to_cost
[FIX] mrp_production_real_cost - include timesheet in cost
This commit is contained in:
@@ -26,14 +26,15 @@ https://github.com/OCA/product-variant
|
||||
Usage
|
||||
=====
|
||||
|
||||
Operating with a manufacture order, analytic entries adding costs will be
|
||||
Processing a manufacture order, analytic entries adding costs will be
|
||||
created when:
|
||||
|
||||
* Some raw material is consumed.
|
||||
* A work order is finished or paused.
|
||||
* Also, together with *project_timesheet* module, users time is also translated
|
||||
to costs in the linked analytic account.
|
||||
|
||||
Also, thanks to *project_timesheet* modules, users time is also translated to
|
||||
costs in the linked analytic account.
|
||||
The sum of all these analytic entries is the real cost.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"project",
|
||||
],
|
||||
'license': 'AGPL-3',
|
||||
"images": [],
|
||||
"author": "OdooMRP team,"
|
||||
"AvanzOSC,"
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza,"
|
||||
@@ -22,7 +23,8 @@
|
||||
"views/mrp_production_view.xml",
|
||||
"views/project_project_view.xml",
|
||||
"views/account_analytic_line_view.xml",
|
||||
"views/project_task_view.xml"
|
||||
"views/project_task_view.xml",
|
||||
"views/hr_analytic_timesheet.xml"
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
|
||||
@@ -8,3 +8,4 @@ from . import account_analytic_line
|
||||
from . import project_project
|
||||
from . import project_task
|
||||
from . import project_task_work
|
||||
from . import hr_analytic_timesheet
|
||||
|
||||
16
mrp_project/models/hr_analytic_timesheet.py
Normal file
16
mrp_project/models/hr_analytic_timesheet.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2016 Daniel Dico <dd@oerp.ca>
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
from openerp import models, api
|
||||
|
||||
|
||||
class HrAnalyticTimesheet(models.Model):
|
||||
_inherit = "hr.analytic.timesheet"
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
production = self._context.get('production', False)
|
||||
vals['mrp_production_id'] = vals.get(
|
||||
'mrp_production_id', False) or production and production.id
|
||||
return super(HrAnalyticTimesheet, self).create(vals)
|
||||
@@ -91,3 +91,8 @@ class MrpProductionWorkcenterLine(models.Model):
|
||||
work_ids = fields.One2many(
|
||||
comodel_name="project.task.work", inverse_name="workorder",
|
||||
string="Task works")
|
||||
|
||||
@api.multi
|
||||
def write(self, vals, update=True):
|
||||
return super(MrpProductionWorkcenterLine, self.with_context(
|
||||
production=self.production_id)).write(vals)
|
||||
|
||||
@@ -29,3 +29,8 @@ class ProjectTask(models.Model):
|
||||
(task.id, "[%s] %s" % (task.user_id.name, task.name)))
|
||||
return res
|
||||
return super(ProjectTask, self).name_get()
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
return super(ProjectTask, self.with_context(
|
||||
production=self.mrp_production_id)).write(vals)
|
||||
|
||||
17
mrp_project/views/hr_analytic_timesheet.xml
Normal file
17
mrp_project/views/hr_analytic_timesheet.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="hr_timesheet_line_tree_mrp" model="ir.ui.view">
|
||||
<field name="name">hr.analytic.timesheet.tree.mrp</field>
|
||||
<field name="model">hr.analytic.timesheet</field>
|
||||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="account_id" position="after">
|
||||
<field name="mrp_production_id" domain="[('analytic_account_id','=',account_id)]" options="{'no_open': True, 'no_create': True}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user