diff --git a/contract_variable_qty_timesheet/README.rst b/contract_variable_qty_timesheet/README.rst new file mode 100644 index 000000000..8acf44fb1 --- /dev/null +++ b/contract_variable_qty_timesheet/README.rst @@ -0,0 +1,101 @@ +=============================== +Contract Variable Qty Timesheet +=============================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png + :target: https://odoo-community.org/page/development-status + :alt: Production/Stable +.. |badge2| 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 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github + :target: https://github.com/OCA/contract/tree/12.0/contract_variable_qty_timesheet + :alt: OCA/contract +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_variable_qty_timesheet + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/110/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends the functionality of contract_variable_quantity adding +several variable quantity formulas to allow to invoice lines from Timesheet +(Analytic Lines). + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +#. Go to Invoicing > Sales > Contracts and select or create a new contract. +#. Check *Generate recurring invoices automatically*. +#. Add a new recurring invoicing line. +#. Select "Variable quantity" in column "Qty. type". +#. Select "Project Timesheets", "Tasks Timesheets" or "Analytic Same Product" + depending on your need. + +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 +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Carlos Dauden + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px + :target: https://github.com/carlosdauden + :alt: carlosdauden +.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px + :target: https://github.com/pedrobaeza + :alt: pedrobaeza + +Current `maintainers `__: + +|maintainer-carlosdauden| |maintainer-pedrobaeza| + +This module is part of the `OCA/contract `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/contract_variable_qty_timesheet/__init__.py b/contract_variable_qty_timesheet/__init__.py new file mode 100644 index 000000000..ef5ae3587 --- /dev/null +++ b/contract_variable_qty_timesheet/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/contract_variable_qty_timesheet/__manifest__.py b/contract_variable_qty_timesheet/__manifest__.py new file mode 100644 index 000000000..3503e440b --- /dev/null +++ b/contract_variable_qty_timesheet/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2018 Tecnativa - Carlos Dauden +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + 'name': 'Contract Variable Qty Timesheet', + 'summary': 'Add formula to invoice ', + 'version': '12.0.1.0.0', + 'category': 'Contract Management', + 'website': 'https://github.com/oca/contract', + 'author': 'Tecnativa, ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'installable': True, + 'development_status': 'Production/Stable', + 'depends': [ + 'contract_variable_quantity', + 'hr_timesheet', + ], + 'data': [ + 'data/contract_line_qty_formula_data.xml', + ], + 'maintainers': ['carlosdauden', 'pedrobaeza'], +} diff --git a/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml b/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml new file mode 100644 index 000000000..213d10749 --- /dev/null +++ b/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml @@ -0,0 +1,45 @@ + + + + + + Project Timesheets + group = env['account.analytic.line'].read_group([ + ('account_id', '=', line.analytic_account_id.id), + ('product_id', '=', False), + ('project_id', '!=', False), + ('date', '>=', period_first_date), + ('date', '<=', period_last_date), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + + Task Timesheets + group = env['account.analytic.line'].read_group([ + ('account_id', '=', line.analytic_account_id.id), + ('product_id', '=', False), + ('task_id', '!=', False), + ('date', '>=', period_first_date), + ('date', '<=', period_last_date), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + + Analytic Same Product + group = env['account.analytic.line'].read_group([ + ('account_id', '=', line.analytic_account_id.id), + ('product_id', '=', line.product_id.id), + ('date', '>=', period_first_date), + ('date', '<=', period_last_date), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + diff --git a/contract_variable_qty_timesheet/i18n/contract_variable_qty_timesheet.pot b/contract_variable_qty_timesheet/i18n/contract_variable_qty_timesheet.pot new file mode 100644 index 000000000..d4d87538a --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/contract_variable_qty_timesheet.pot @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.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: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "" + diff --git a/contract_variable_qty_timesheet/i18n/de.po b/contract_variable_qty_timesheet/i18n/de.po new file mode 100644 index 000000000..4b09653ee --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/de.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-03-07 15:53+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.4\n" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "Gleiches Produkt" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "Projekt-Zeiterfassungen" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "Aufgaben-Zeiterfassungen" diff --git a/contract_variable_qty_timesheet/i18n/es.po b/contract_variable_qty_timesheet/i18n/es.po new file mode 100644 index 000000000..7281d4ce1 --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/es.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-29 11:13+0200\n" +"PO-Revision-Date: 2018-03-29 11:21+0200\n" +"Last-Translator: Carlos Dauden \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.7.1\n" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "Analítica mismo producto" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "Partes de horas de proyectos" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "Partes de horas de tareas" diff --git a/contract_variable_qty_timesheet/i18n/fr.po b/contract_variable_qty_timesheet/i18n/fr.po new file mode 100644 index 000000000..4b87abfdd --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/fr.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +# Translators: +# Quentin THEURET , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-06 21:09+0000\n" +"PO-Revision-Date: 2018-04-06 21:09+0000\n" +"Last-Translator: Quentin THEURET , 2018\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: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "Même produit analytique" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "Feuilles de temps du projet" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "Feuille de temps de la tâche" diff --git a/contract_variable_qty_timesheet/i18n/it.po b/contract_variable_qty_timesheet/i18n/it.po new file mode 100644 index 000000000..f0f322638 --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/it.po @@ -0,0 +1,32 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2018-12-24 23:58+0000\n" +"Last-Translator: Sergio Zanchetta \n" +"Language-Team: none\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.3\n" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "Fogli ore progetto" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "Fogli ore attività" diff --git a/contract_variable_qty_timesheet/i18n/zh.po b/contract_variable_qty_timesheet/i18n/zh.po new file mode 100644 index 000000000..95285088b --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/zh.po @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +# Translators: +# DIT INTL , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-04-27 01:12+0000\n" +"PO-Revision-Date: 2018-04-27 01:12+0000\n" +"Last-Translator: DIT INTL , 2018\n" +"Language-Team: Chinese (https://www.transifex.com/oca/teams/23907/zh/)\n" +"Language: zh\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "分析同一产品" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "项目时间表" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "任务时间表" diff --git a/contract_variable_qty_timesheet/readme/CONTRIBUTORS.rst b/contract_variable_qty_timesheet/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..e88bd67dd --- /dev/null +++ b/contract_variable_qty_timesheet/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Carlos Dauden + * Pedro M. Baeza diff --git a/contract_variable_qty_timesheet/readme/DESCRIPTION.rst b/contract_variable_qty_timesheet/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0b238e9b7 --- /dev/null +++ b/contract_variable_qty_timesheet/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module extends the functionality of contract_variable_quantity adding +several variable quantity formulas to allow to invoice lines from Timesheet +(Analytic Lines). diff --git a/contract_variable_qty_timesheet/readme/USAGE.rst b/contract_variable_qty_timesheet/readme/USAGE.rst new file mode 100644 index 000000000..3ca264dc0 --- /dev/null +++ b/contract_variable_qty_timesheet/readme/USAGE.rst @@ -0,0 +1,8 @@ +To use this module, you need to: + +#. Go to Invoicing > Sales > Contracts and select or create a new contract. +#. Check *Generate recurring invoices automatically*. +#. Add a new recurring invoicing line. +#. Select "Variable quantity" in column "Qty. type". +#. Select "Project Timesheets", "Tasks Timesheets" or "Analytic Same Product" + depending on your need. diff --git a/contract_variable_qty_timesheet/static/description/icon.png b/contract_variable_qty_timesheet/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/contract_variable_qty_timesheet/static/description/icon.png differ diff --git a/contract_variable_qty_timesheet/static/description/index.html b/contract_variable_qty_timesheet/static/description/index.html new file mode 100644 index 000000000..b65106f89 --- /dev/null +++ b/contract_variable_qty_timesheet/static/description/index.html @@ -0,0 +1,440 @@ + + + + + + +Contract Variable Qty Timesheet + + + +
+

Contract Variable Qty Timesheet

+ + +

Production/Stable License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runbot

+

This module extends the functionality of contract_variable_quantity adding +several variable quantity formulas to allow to invoice lines from Timesheet +(Analytic Lines).

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Invoicing > Sales > Contracts and select or create a new contract.
  2. +
  3. Check Generate recurring invoices automatically.
  4. +
  5. Add a new recurring invoicing line.
  6. +
  7. Select “Variable quantity” in column “Qty. type”.
  8. +
  9. Select “Project Timesheets”, “Tasks Timesheets” or “Analytic Same Product” +depending on your need.
  10. +
+
+
+

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

+
    +
  • Tecnativa:
      +
    • Carlos Dauden
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainers:

+

carlosdauden pedrobaeza

+

This module is part of the OCA/contract project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/contract_variable_qty_timesheet/tests/__init__.py b/contract_variable_qty_timesheet/tests/__init__.py new file mode 100644 index 000000000..2bdf08124 --- /dev/null +++ b/contract_variable_qty_timesheet/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import test_contract_variable_qty_timesheet diff --git a/contract_variable_qty_timesheet/tests/test_contract_variable_qty_timesheet.py b/contract_variable_qty_timesheet/tests/test_contract_variable_qty_timesheet.py new file mode 100644 index 000000000..bf08e65e6 --- /dev/null +++ b/contract_variable_qty_timesheet/tests/test_contract_variable_qty_timesheet.py @@ -0,0 +1,96 @@ +# Copyright 2019 Tecnativa - Pedro M. Baeza +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields +from odoo.tests import common + + +class TestContractVariableQtyTimesheet(common.SavepointCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env['res.partner'].create({'name': 'Test partner'}) + cls.analytic_account = cls.env['account.analytic.account'].create({ + 'name': 'Test analytic account'}) + cls.contract = cls.env['contract.contract'].create({ + 'name': 'Test contract', + 'partner_id': cls.partner.id}) + cls.product = cls.env['product.product'].create({ + 'name': 'Test product'}) + contract_line_vals = { + 'contract_id': cls.contract.id, + 'analytic_account_id': cls.analytic_account.id, + 'product_id': cls.product.id, + 'uom_id': cls.product.uom_id.id, + 'name': 'Test line contract', + 'recurring_interval': 1, + 'recurring_rule_type': 'monthly', + 'recurring_invoicing_type': 'pre-paid', + 'date_start': '2020-01-01', + 'recurring_next_date': '2020-01-01', + 'qty_type': 'variable', + 'qty_formula_id': cls.env.ref( + 'contract_variable_qty_timesheet.' + 'contract_line_qty_formula_project_timesheet').id, + } + cls.contract_line = cls.env['contract.line'].create( + contract_line_vals) + cls.project = cls.env['project.project'].create({ + 'name': 'Test project', + 'analytic_account_id': cls.analytic_account.id, + }) + cls.task = cls.env['project.task'].create({ + 'project_id': cls.project.id, + 'name': 'Test task', + }) + + def _contract_invoicing(self, contract): + date_ref = fields.Date.from_string('2020-01-01') + contract._recurring_create_invoice(date_ref) + return contract._get_related_invoices() + + def _create_analytic_line(self, project, task, date, product, unit_amount): + return self.env['account.analytic.line'].create({ + 'account_id': self.analytic_account.id, + 'project_id': project and project.id, + 'task_id': task and task.id, + 'name': 'Test %s %s' % (date, unit_amount), + 'date': date, + 'product_id': product and product.id, + 'unit_amount': unit_amount, + }) + + def test_project_timesheet(self): + self._create_analytic_line( + self.project, self.task, '2020-01-01', False, 3) + self._create_analytic_line( + False, False, '2020-01-01', False, 1) + invoice = self._contract_invoicing(self.contract) + self.assertEqual(len(invoice.invoice_line_ids), 1) + self.assertAlmostEqual(invoice.invoice_line_ids.quantity, 3) + + def test_task_timesheet(self): + self.contract_line.qty_formula_id = self.env.ref( + 'contract_variable_qty_timesheet.' + 'contract_line_qty_formula_task_timesheet' + ).id + self._create_analytic_line( + self.project, self.task, '2020-01-01', False, 3) + self._create_analytic_line( + self.project, False, '2020-01-01', False, 1) + invoice = self._contract_invoicing(self.contract) + self.assertEqual(len(invoice.invoice_line_ids), 1) + self.assertAlmostEqual(invoice.invoice_line_ids.quantity, 3) + + def test_same_product(self): + self.contract_line.qty_formula_id = self.env.ref( + 'contract_variable_qty_timesheet.' + 'contract_line_qty_formula_analytic_same_product' + ).id + self._create_analytic_line( + False, False, '2020-01-01', self.product, 3) + self._create_analytic_line( + self.project, False, '2020-01-01', False, 1) + invoice = self._contract_invoicing(self.contract) + self.assertEqual(len(invoice.invoice_line_ids), 1) + self.assertAlmostEqual(invoice.invoice_line_ids.quantity, 3)