openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #01468
[Merge] lp:~dreis-pt/project-service/7.0-task_materials-dr into lp:project-service
Daniel Reis has proposed merging lp:~dreis-pt/project-service/7.0-task_materials-dr into lp:project-service.
Requested reviews:
Project Core Editors (project-core-editors)
For more details, see:
https://code.launchpad.net/~dreis-pt/project-service/7.0-task_materials-dr/+merge/195642
Port of "Task Materials" module to v7.
This is a basic implementation of the feature, without link to Analytic Account lines.
That, if needed, should be provided by an extension module, similarly to what `project_timesheet` does with the "Work on Tasks" basic feature.
--
https://code.launchpad.net/~dreis-pt/project-service/7.0-task_materials-dr/+merge/195642
Your team Project Core Editors is requested to review the proposed merge of lp:~dreis-pt/project-service/7.0-task_materials-dr into lp:project-service.
=== modified file 'project_task_materials/__init__.py' (properties changed: +x to -x)
=== modified file 'project_task_materials/__openerp__.py' (properties changed: +x to -x)
--- project_task_materials/__openerp__.py 2013-03-04 16:16:31 +0000
+++ project_task_materials/__openerp__.py 2013-11-18 17:39:08 +0000
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
#
-# Copyright (C) 2012 Daniel Reis
+# Copyright (C) 2012 - 2013 Daniel Reis
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -19,18 +19,24 @@
##############################################################################
{
- 'name': 'Project task materials',
- 'version': '1',
- "category": "Project Management",
+ 'name': 'Project Task Materials',
+ 'summary': 'Record products spend in a Task',
+ 'version': '1.0',
+ 'category': "Project Management",
'author': 'Daniel Reis',
- 'website': 'daniel.reis@xxxxxxxxxxxx',
- 'depends': ['project', 'account'],
- 'update_xml': [
+ 'description': """\
+Project Tasks allow to record time spent, if the "Log work activities on tasks"
+setting is activated.
+This nodules allows to also record materials spent, as is often needed in the
+case of field service activities.
+
+Important note: this implementation module does not integrate with stocks o
+r accounting.""",
+ 'depends': ['project', 'product'],
+ 'data': [
'project_view.xml',
- 'project_materials_data.xml',
'security/ir.model.access.csv',
],
- 'installable': False,
- 'application': False,
+ 'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'project_task_materials/i18n'
=== added file 'project_task_materials/i18n/project_task_materials.pot'
--- project_task_materials/i18n/project_task_materials.pot 1970-01-01 00:00:00 +0000
+++ project_task_materials/i18n/project_task_materials.pot 2013-11-18 17:39:08 +0000
@@ -0,0 +1,44 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * project_task_materials
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-11-18 17:09+0000\n"
+"PO-Revision-Date: 2013-11-18 17:09+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: project_task_materials
+#: model:ir.model,name:project_task_materials.model_project_task
+#: field:project.task.materials,task_id:0
+msgid "Task"
+msgstr ""
+
+#. module: project_task_materials
+#: field:project.task.materials,product_id:0
+msgid "Product"
+msgstr ""
+
+#. module: project_task_materials
+#: field:project.task.materials,quantity:0
+msgid "Quantity"
+msgstr ""
+
+#. module: project_task_materials
+#: model:ir.model,name:project_task_materials.model_project_task_materials
+msgid "Task Materials Used"
+msgstr ""
+
+#. module: project_task_materials
+#: view:project.task:0
+#: field:project.task,material_ids:0
+msgid "Materials used"
+msgstr ""
+
=== modified file 'project_task_materials/project.py' (properties changed: +x to -x)
--- project_task_materials/project.py 2012-12-27 23:13:17 +0000
+++ project_task_materials/project.py 2013-11-18 17:39:08 +0000
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
-# Copyright (C) 2012 Daniel Reis
+#
+# Copyright (C) 2012 - 2013 Daniel Reis
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -18,60 +18,24 @@
#
##############################################################################
-from osv import fields, osv
-
-
-class task(osv.osv):
+from openerp.osv import fields, orm
+
+
+class task(orm.Model):
_inherit = "project.task"
_columns = {
- #new
- 'material_ids': fields.one2many('project.task.materials', 'task_id', 'Materials used'),
- #modified
- 'project_id': fields.many2one('project.project', 'Project', ondelete='set null', select="1"
- , required=True), #project is now required
+ 'material_ids': fields.one2many(
+ 'project.task.materials', 'task_id', 'Materials used'),
}
-task()
-
-
-class project_task_materials(osv.osv):
+
+
+class project_task_materials(orm.Model):
_name = "project.task.materials"
- _description = "Project Task Materials Used"
- _inherits = {'account.analytic.line': 'line_id'}
-
- def _getAnalyticJournal(self, cr, uid, context=None):
- md = self.pool.get('ir.model.data')
- try:
- return md.get_object_reference(cr, uid, 'project_task_materials', 'materials_analytic_journal')[1]
- except ValueError:
- pass
- return False
-
+ _description = "Task Materials Used"
_columns = {
- 'task_id': fields.many2one('project.task', 'Task', ondelete='cascade', required=True),
- 'line_id': fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade', required=True),
- }
-# _defaults = {
-# 'journal_id': lambda self, cr, uid, ctx: _getAnalyticJournal,
-# }
-
- def create(self, cr, uid, vals, *args, **kwargs):
- task_mdl = self.pool.get('project.task')
- task_doc = task_mdl.browse( cr, uid, [vals['task_id']] )[0]
- prod_mdl = self.pool.get('product.product')
- prod_doc = prod_mdl.browse( cr, uid, [vals['product_id']] )[0]
- vals.update({
- 'journal_id': self._getAnalyticJournal(cr, uid),
- #Task defaults:
- 'name': task_doc.name,
- 'account_id': task_doc.project_id.analytic_account_id.id,
- 'to_invoice': task_doc.project_id.analytic_account_id.to_invoice.id,
- #Product defaults:
- 'product_uom_id': prod_doc.uom_id.id,
- 'general_account_id': prod_doc.product_tmpl_id.property_account_expense.id
- or prod_doc.categ_id.property_account_expense_categ.id,
- })
- return super(project_task_materials, self).create(cr, uid, vals, *args, **kwargs)
-
-project_task_materials()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ 'task_id': fields.many2one(
+ 'project.task', 'Task', ondelete='cascade', required=True),
+ 'product_id': fields.many2one(
+ 'product.product', 'Product', required=True),
+ 'quantity': fields.float('Quantity'),
+ }
=== removed file 'project_task_materials/project_materials_data.xml'
--- project_task_materials/project_materials_data.xml 2012-11-22 13:29:38 +0000
+++ project_task_materials/project_materials_data.xml 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data noupdate="1">
-
- <record id="materials_analytic_journal" model="account.analytic.journal">
- <field name="code">PM</field>
- <field name="name">Project Materials Journal</field>
- <field name="type">general</field>
- </record>
-
- </data>
-</openerp>
=== modified file 'project_task_materials/project_view.xml' (properties changed: +x to -x)
--- project_task_materials/project_view.xml 2012-11-22 14:24:56 +0000
+++ project_task_materials/project_view.xml 2013-11-18 17:39:08 +0000
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
- <data>
-
- <record id="view_project_task_form_materials" model="ir.ui.view">
- <field name="name">project.task.form.materials</field>
- <field name="model">project.task</field>
- <field name="inherit_id" ref="project.view_task_form2"/>
- <field name="arch" type="xml">
- <field position="before" name="work_ids">
- <!--Materials used-->
- <field colspan="4" name="material_ids" nolabel="1"
- attrs="{'readonly':[('state','in',['done','draft'])]}">
- <tree string="Materials used" editable="top">
- <field name="product_id" required="1"/>
- <field name="unit_amount" string="Qty."/>
- <field name="product_uom_id" readonly="1"/>
- </tree>
- </field>
- </field>
- </field>
- </record>
-
- </data>
+ <data>
+
+ <record id="view_project_task_form_materials" model="ir.ui.view">
+ <field name="name">project.task.form.materials</field>
+ <field name="model">project.task</field>
+ <field name="inherit_id" ref="project.view_task_form2"/>
+ <field name="arch" type="xml">
+
+ <field position="after" name="work_ids">
+ <!--Materials used-->
+ <field name="material_ids" groups="project.group_tasks_work_on_tasks">
+ <tree string="Materials used" editable="top">
+ <field name="product_id"/>
+ <field name="quantity"/>
+ </tree>
+ </field>
+ </field>
+
+ </field>
+ </record>
+
+ </data>
</openerp>
=== modified file 'project_task_materials/security/ir.model.access.csv' (properties changed: +x to -x)
--- project_task_materials/security/ir.model.access.csv 2012-12-27 23:13:17 +0000
+++ project_task_materials/security/ir.model.access.csv 2013-11-18 17:39:08 +0000
@@ -1,3 +1,3 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_model_project_task_materials_project_manager2","model_project_task_materials_project_manager","model_project_task_materials","project.group_project_manager",1,1,1,1
-"access_model_project_task_materials_project_user2","model_project_task_materials_project_user","model_project_task_materials","project.group_project_user",1,0,0,0
+"access_model_project_task_materials_project_user2","model_project_task_materials_project_user","model_project_task_materials","project.group_project_user",1,1,1,1
+"access_model_project_task_materials_employee","model_project_task_materials_employee","model_project_task_materials","base.group_user",1,0,0,0