diff --git a/crm_claim_timesheet/README.rst b/crm_claim_timesheet/README.rst new file mode 100644 index 00000000..91bca1db --- /dev/null +++ b/crm_claim_timesheet/README.rst @@ -0,0 +1,54 @@ +=================== +CRM Claim Timesheet +=================== + +.. |badge1| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + + +|badge1| + +This module allows to generate timesheets from claims. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* In pipeline/lead forms you have Timesheet tab. + +Known issues / Roadmap +====================== + +* Window actions `crm.crm_lead_all_leads` and + `crm.crm_lead_opportunities_tree_view` contexts are overwritten for + hiding the lead field in timesheet embedded view. As this is not + accumulative, this change might be lost by other module overwritting the + same action, or this masks another module overwritting. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + + diff --git a/crm_claim_timesheet/__init__.py b/crm_claim_timesheet/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/crm_claim_timesheet/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/crm_claim_timesheet/__manifest__.py b/crm_claim_timesheet/__manifest__.py new file mode 100644 index 00000000..9cb994f0 --- /dev/null +++ b/crm_claim_timesheet/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2019 Oihane Crucelaegui - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "CRM Claim Timesheet", + "version": "12.0.1.0.0", + "category": "Customer Relationship Management", + "license": "AGPL-3", + "author": "AvanzOSC", + "website": "http://www.avanzosc.es", + "depends": [ + "crm_claim", + "hr_timesheet" + ], + "data": [ + "views/crm_claim_view.xml", + "views/hr_timesheet_view.xml", + ], + "installable": True, +} diff --git a/crm_claim_timesheet/i18n/crm_timesheet.pot b/crm_claim_timesheet/i18n/crm_timesheet.pot new file mode 100644 index 00000000..339c1d77 --- /dev/null +++ b/crm_claim_timesheet/i18n/crm_timesheet.pot @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "" + diff --git a/crm_claim_timesheet/i18n/cs_CZ.po b/crm_claim_timesheet/i18n/cs_CZ.po new file mode 100644 index 00000000..ece00622 --- /dev/null +++ b/crm_claim_timesheet/i18n/cs_CZ.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-23 01:55+0000\n" +"PO-Revision-Date: 2018-02-23 01:55+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "Analytická linka" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "Vedoucí/příležitost" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "Projekt" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "Rozvrh hodin" diff --git a/crm_claim_timesheet/i18n/de.po b/crm_claim_timesheet/i18n/de.po new file mode 100644 index 00000000..217f1efc --- /dev/null +++ b/crm_claim_timesheet/i18n/de.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-07-11 12:43+0000\n" +"Last-Translator: Maria Sparenberg \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "Kostenstellenbuchung" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "Interessent / Chance" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "Projekt" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "Zeiterfassung" diff --git a/crm_claim_timesheet/i18n/es.po b/crm_claim_timesheet/i18n/es.po new file mode 100644 index 00000000..8ae09c31 --- /dev/null +++ b/crm_claim_timesheet/i18n/es.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +# Translators: +# OCA Transbot , 2018 +# enjolras , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-03 05:20+0000\n" +"PO-Revision-Date: 2018-03-03 05:20+0000\n" +"Last-Translator: enjolras , 2018\n" +"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "Línea analítica" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "Iniciativa/Oportunidad" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "Proyecto" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "Parte de horas" diff --git a/crm_claim_timesheet/i18n/fr.po b/crm_claim_timesheet/i18n/fr.po new file mode 100644 index 00000000..410455a2 --- /dev/null +++ b/crm_claim_timesheet/i18n/fr.po @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +# Translators: +# Quentin THEURET , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-08-18 00:44+0000\n" +"PO-Revision-Date: 2017-08-18 00:44+0000\n" +"Last-Translator: Quentin THEURET , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "Ligne analytique" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "Piste/Opportunité" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "Feuille de temps" diff --git a/crm_claim_timesheet/i18n/it.po b/crm_claim_timesheet/i18n/it.po new file mode 100644 index 00000000..3fde213e --- /dev/null +++ b/crm_claim_timesheet/i18n/it.po @@ -0,0 +1,43 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * crm_timesheet +# +# Translators: +# Marco Calcagni , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-31 04:45+0000\n" +"PO-Revision-Date: 2018-10-28 23:00+0000\n" +"Last-Translator: Sergio Zanchetta \n" +"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.2.1\n" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_account_analytic_line +msgid "Analytic Line" +msgstr "Riga analitica" + +#. module: crm_timesheet +#: model:ir.model,name:crm_timesheet.model_crm_lead +#: model:ir.model.fields,field_description:crm_timesheet.field_account_analytic_line__lead_id +msgid "Lead/Opportunity" +msgstr "Lead/Opportunità" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__project_id +msgid "Project" +msgstr "Progetto" + +#. module: crm_timesheet +#: model:ir.model.fields,field_description:crm_timesheet.field_crm_lead__timesheet_ids +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_leads +#: model_terms:ir.ui.view,arch_db:crm_timesheet.crm_case_form_view_oppor +msgid "Timesheet" +msgstr "Foglio ore" diff --git a/crm_claim_timesheet/models/__init__.py b/crm_claim_timesheet/models/__init__.py new file mode 100644 index 00000000..47c66195 --- /dev/null +++ b/crm_claim_timesheet/models/__init__.py @@ -0,0 +1,2 @@ +from . import crm_claim +from . import account_analytic_line diff --git a/crm_claim_timesheet/models/account_analytic_line.py b/crm_claim_timesheet/models/account_analytic_line.py new file mode 100644 index 00000000..c3efc3e1 --- /dev/null +++ b/crm_claim_timesheet/models/account_analytic_line.py @@ -0,0 +1,18 @@ +# Copyright 2019 Oihane Crucelaegui - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models + + +class AccountAnalyticLine(models.Model): + _inherit = 'account.analytic.line' + + claim_id = fields.Many2one( + comodel_name='crm.claim', + string='Claim', + ) + + @api.onchange('claim_id') + def _onchange_claim_id(self): + if self.claim_id.project_id: + self.project_id = self.claim_id.project_id diff --git a/crm_claim_timesheet/models/crm_claim.py b/crm_claim_timesheet/models/crm_claim.py new file mode 100644 index 00000000..0ef3fc5b --- /dev/null +++ b/crm_claim_timesheet/models/crm_claim.py @@ -0,0 +1,19 @@ +# Copyright 2019 Oihane Crucelaegui - AvanzOSC +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import fields, models + + +class CrmClaim(models.Model): + _inherit = 'crm.claim' + + project_id = fields.Many2one( + comodel_name='project.project', + string="Project", + ) + timesheet_ids = fields.One2many( + comodel_name='account.analytic.line', + inverse_name='claim_id', + string="Timesheet", + ) diff --git a/crm_claim_timesheet/tests/__init__.py b/crm_claim_timesheet/tests/__init__.py new file mode 100644 index 00000000..0dbc16a6 --- /dev/null +++ b/crm_claim_timesheet/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import test_account_analytic_line diff --git a/crm_claim_timesheet/tests/test_account_analytic_line.py b/crm_claim_timesheet/tests/test_account_analytic_line.py new file mode 100644 index 00000000..9e4cedd1 --- /dev/null +++ b/crm_claim_timesheet/tests/test_account_analytic_line.py @@ -0,0 +1,32 @@ +# Copyright 2017 Jairo Llopis +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import SavepointCase + + +class AccountAnalyticLineCase(SavepointCase): + @classmethod + def setUpClass(cls): + super(AccountAnalyticLineCase, cls).setUpClass() + Account = cls.env["account.analytic.account"] + Project = cls.env["project.project"] + cls.Line = cls.env["account.analytic.line"] + cls.account1 = Account.create({ + "name": "Test Account 1", + }) + cls.project1 = Project.create({ + "name": "Test Project 1", + "analytic_account_id": cls.account1.id, + }) + cls.claim = cls.env['crm.claim'].create({ + 'name': 'Test lead', + 'project_id': cls.project1.id, + }) + + def test_onchange_lead(self): + """Changing the lead changes the associated project.""" + line = self.Line.new({ + "claim_id": self.lead.id, + }) + line._onchange_claim_id() + self.assertEqual(line.project_id, self.project1) diff --git a/crm_claim_timesheet/views/crm_claim_view.xml b/crm_claim_timesheet/views/crm_claim_view.xml new file mode 100644 index 00000000..0519f2dc --- /dev/null +++ b/crm_claim_timesheet/views/crm_claim_view.xml @@ -0,0 +1,48 @@ + + + + + CRM - Claims with timesheets + crm.claim + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/crm_claim_timesheet/views/hr_timesheet_view.xml b/crm_claim_timesheet/views/hr_timesheet_view.xml new file mode 100644 index 00000000..5d9aec6d --- /dev/null +++ b/crm_claim_timesheet/views/hr_timesheet_view.xml @@ -0,0 +1,15 @@ + + + + + account.analytic.line + + + + + + + + + +