mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[MIG] contract_variable_qty_timesheet: Migration to 16.0
This commit is contained in:
committed by
Pedro M. Baeza
parent
d16adf0b98
commit
11e0a529a2
@@ -7,7 +7,7 @@ Contract Variable Qty Timesheet
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e5498feee850c8ae2cc09cbae0c07393069f065c83bca8823127e9eec40bbe1b
|
||||
!! source digest: sha256:73b06705689ef093fa9faf3acbdfedbee3ddf23da70d43f7137298b1bd32c7eb
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -17,13 +17,13 @@ Contract Variable Qty Timesheet
|
||||
: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/15.0/contract_variable_qty_timesheet
|
||||
:target: https://github.com/OCA/contract/tree/16.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-15-0/contract-15-0-contract_variable_qty_timesheet
|
||||
:target: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_qty_timesheet
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=15.0
|
||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=16.0
|
||||
:alt: Try me on Runboat
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -42,7 +42,7 @@ Usage
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to Invoicing > Sales > Contracts and select or create a new contract.
|
||||
#. Go to Invoicing > Customers > Customer 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".
|
||||
@@ -55,7 +55,7 @@ Bug Tracker
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_qty_timesheet%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_qty_timesheet%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@@ -80,6 +80,10 @@ Contributors
|
||||
|
||||
* Fernando La Chica <fernandolachica@gmail.com>
|
||||
|
||||
* `Coopdevs Treball <https://coopdevs.coop>`_:
|
||||
|
||||
* Daniel Palomar <daniel.palomar@coopdevs.org>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -99,11 +103,14 @@ promote its widespread use.
|
||||
.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px
|
||||
:target: https://github.com/pedrobaeza
|
||||
:alt: pedrobaeza
|
||||
.. |maintainer-danypr92| image:: https://github.com/danypr92.png?size=40px
|
||||
:target: https://github.com/danypr92
|
||||
:alt: danypr92
|
||||
|
||||
Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-carlosdauden| |maintainer-pedrobaeza|
|
||||
|maintainer-carlosdauden| |maintainer-pedrobaeza| |maintainer-danypr92|
|
||||
|
||||
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/15.0/contract_variable_qty_timesheet>`_ project on GitHub.
|
||||
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/16.0/contract_variable_qty_timesheet>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{
|
||||
"name": "Contract Variable Qty Timesheet",
|
||||
"summary": "Add formula to invoice ",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Contract Management",
|
||||
"website": "https://github.com/OCA/contract",
|
||||
"author": "Tecnativa, " "Odoo Community Association (OCA)",
|
||||
@@ -13,5 +13,5 @@
|
||||
"installable": True,
|
||||
"depends": ["contract_variable_quantity", "hr_timesheet"],
|
||||
"data": ["data/contract_line_qty_formula_data.xml"],
|
||||
"maintainers": ["carlosdauden", "pedrobaeza"],
|
||||
"maintainers": ["carlosdauden", "pedrobaeza", "danypr92"],
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
model="contract.line.qty.formula"
|
||||
>
|
||||
<field name='name'>Project Timesheets</field>
|
||||
<field name="code">group = env['account.analytic.line'].read_group([
|
||||
('account_id', '=', line.analytic_account_id.id),
|
||||
<field name="code">
|
||||
account_analytic_ids = line.analytic_distribution and [int(_id) for _id in list(line.analytic_distribution.keys())] or []
|
||||
group = env['account.analytic.line'].read_group([
|
||||
('account_id', 'in', account_analytic_ids),
|
||||
('product_id', '=', False),
|
||||
('project_id', '!=', False),
|
||||
('date', '>=', period_first_date),
|
||||
@@ -23,8 +25,10 @@ result = group and group[0]['unit_amount'] or 0.0
|
||||
model="contract.line.qty.formula"
|
||||
>
|
||||
<field name='name'>Task Timesheets</field>
|
||||
<field name="code">group = env['account.analytic.line'].read_group([
|
||||
('account_id', '=', line.analytic_account_id.id),
|
||||
<field name="code">
|
||||
account_analytic_ids = line.analytic_distribution and [int(_id) for _id in list(line.analytic_distribution.keys())] or []
|
||||
group = env['account.analytic.line'].read_group([
|
||||
('account_id', 'in', account_analytic_ids),
|
||||
('product_id', '=', False),
|
||||
('task_id', '!=', False),
|
||||
('date', '>=', period_first_date),
|
||||
@@ -38,8 +42,10 @@ result = group and group[0]['unit_amount'] or 0.0
|
||||
model="contract.line.qty.formula"
|
||||
>
|
||||
<field name='name'>Analytic Same Product</field>
|
||||
<field name="code">group = env['account.analytic.line'].read_group([
|
||||
('account_id', '=', line.analytic_account_id.id),
|
||||
<field name="code">
|
||||
account_analytic_ids = line.analytic_distribution and [int(_id) for _id in list(line.analytic_distribution.keys())] or []
|
||||
group = env['account.analytic.line'].read_group([
|
||||
('account_id', 'in', account_analytic_ids),
|
||||
('product_id', '=', line.product_id.id),
|
||||
('date', '>=', period_first_date),
|
||||
('date', '<=', period_last_date),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 15.0\n"
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
||||
@@ -7,3 +7,7 @@
|
||||
* `Guadaltech <https://www.guadaltech.es>`_:
|
||||
|
||||
* Fernando La Chica <fernandolachica@gmail.com>
|
||||
|
||||
* `Coopdevs Treball <https://coopdevs.coop>`_:
|
||||
|
||||
* Daniel Palomar <daniel.palomar@coopdevs.org>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to Invoicing > Sales > Contracts and select or create a new contract.
|
||||
#. Go to Invoicing > Customers > Customer 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".
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# addons listed in this file are ignored by
|
||||
# setuptools-odoo-make-default (one addon per line)
|
||||
2
contract_variable_qty_timesheet/setup/README
Normal file
2
contract_variable_qty_timesheet/setup/README
Normal file
@@ -0,0 +1,2 @@
|
||||
To learn more about this directory, please visit
|
||||
https://pypi.python.org/pypi/setuptools-odoo
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -9,10 +8,11 @@
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
@@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
@@ -301,7 +301,7 @@ span.option {
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
@@ -367,9 +367,9 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:e5498feee850c8ae2cc09cbae0c07393069f065c83bca8823127e9eec40bbe1b
|
||||
!! source digest: sha256:73b06705689ef093fa9faf3acbdfedbee3ddf23da70d43f7137298b1bd32c7eb
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/15.0/contract_variable_qty_timesheet"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-15-0/contract-15-0-contract_variable_qty_timesheet"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/16.0/contract_variable_qty_timesheet"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-contract_variable_qty_timesheet"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module extends the functionality of contract_variable_quantity adding
|
||||
several variable quantity formulas to allow to invoice lines from Timesheet
|
||||
(Analytic Lines).</p>
|
||||
@@ -390,7 +390,7 @@ several variable quantity formulas to allow to invoice lines from Timesheet
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
||||
<p>To use this module, you need to:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to Invoicing > Sales > Contracts and select or create a new contract.</li>
|
||||
<li>Go to Invoicing > Customers > Customer Contracts and select or create a new contract.</li>
|
||||
<li>Check <em>Generate recurring invoices automatically</em>.</li>
|
||||
<li>Add a new recurring invoicing line.</li>
|
||||
<li>Select “Variable quantity” in column “Qty. type”.</li>
|
||||
@@ -403,7 +403,7 @@ depending on your need.</li>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_qty_timesheet%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20contract_variable_qty_timesheet%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@@ -427,18 +427,24 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Fernando La Chica <<a class="reference external" href="mailto:fernandolachica@gmail.com">fernandolachica@gmail.com</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference external" href="https://coopdevs.coop">Coopdevs Treball</a>:<ul>
|
||||
<li>Daniel Palomar <<a class="reference external" href="mailto:daniel.palomar@coopdevs.org">daniel.palomar@coopdevs.org</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<p>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.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/15.0/contract_variable_qty_timesheet">OCA/contract</a> project on GitHub.</p>
|
||||
<p><a class="reference external image-reference" href="https://github.com/carlosdauden"><img alt="carlosdauden" src="https://github.com/carlosdauden.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/danypr92"><img alt="danypr92" src="https://github.com/danypr92.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/16.0/contract_variable_qty_timesheet">OCA/contract</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,44 +2,70 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields
|
||||
from odoo.tests import common
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestContractVariableQtyTimesheet(common.TransactionCase):
|
||||
class TestContractVariableQtyTimesheet(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.partner = cls.env["res.partner"].create({"name": "Test partner"})
|
||||
cls.company = cls.env.company
|
||||
cls.partner = cls.env["res.partner"].create(
|
||||
{"name": "Test partner", "company_id": cls.company.id}
|
||||
)
|
||||
cls.plan = cls.env["account.analytic.plan"].create({"name": "Test Plan"})
|
||||
cls.analytic_account = cls.env["account.analytic.account"].create(
|
||||
{"name": "Test analytic account"}
|
||||
{
|
||||
"name": "Test analytic account",
|
||||
"plan_id": cls.plan.id,
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
cls.contract = cls.env["contract.contract"].create(
|
||||
{"name": "Test contract", "partner_id": cls.partner.id}
|
||||
{
|
||||
"name": "Test contract",
|
||||
"partner_id": cls.partner.id,
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
cls.product = cls.env["product.product"].create(
|
||||
{"name": "Test product", "company_id": cls.company.id}
|
||||
)
|
||||
cls.employee = cls.env["hr.employee"].create(
|
||||
{
|
||||
"name": "Test Employee",
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
cls.product = cls.env["product.product"].create({"name": "Test product"})
|
||||
contract_line_vals = {
|
||||
"name": "Test contract line",
|
||||
"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",
|
||||
"date_end": "2020-12-31",
|
||||
"product_id": cls.product.id,
|
||||
"qty_formula_id": cls.env.ref(
|
||||
"contract_variable_qty_timesheet."
|
||||
"contract_line_qty_formula_project_timesheet"
|
||||
"contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet"
|
||||
).id,
|
||||
"sequence": 10,
|
||||
"state": "in-progress",
|
||||
"company_id": cls.company.id,
|
||||
"qty_type": "variable",
|
||||
"analytic_distribution": {str(cls.analytic_account.id): 100},
|
||||
}
|
||||
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}
|
||||
{
|
||||
"name": "Test project",
|
||||
"analytic_account_id": cls.analytic_account.id,
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
cls.task = cls.env["project.task"].create(
|
||||
{"project_id": cls.project.id, "name": "Test task"}
|
||||
{
|
||||
"project_id": cls.project.id,
|
||||
"name": "Test task",
|
||||
"company_id": cls.company.id,
|
||||
}
|
||||
)
|
||||
|
||||
def _contract_invoicing(self, contract):
|
||||
@@ -53,38 +79,38 @@ class TestContractVariableQtyTimesheet(common.TransactionCase):
|
||||
"account_id": self.analytic_account.id,
|
||||
"project_id": project and project.id,
|
||||
"task_id": task and task.id,
|
||||
"name": "Test {} {}".format(date, unit_amount),
|
||||
"name": f"Test {date} {unit_amount}",
|
||||
"date": date,
|
||||
"product_id": product and product.id,
|
||||
"unit_amount": unit_amount,
|
||||
"employee_id": self.employee.id,
|
||||
"company_id": self.company.id,
|
||||
}
|
||||
)
|
||||
|
||||
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)
|
||||
invoice = self.contract._recurring_create_invoice()
|
||||
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"
|
||||
"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)
|
||||
invoice = self.contract._recurring_create_invoice()
|
||||
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"
|
||||
"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)
|
||||
invoice = self.contract._recurring_create_invoice()
|
||||
self.assertEqual(len(invoice.invoice_line_ids), 1)
|
||||
self.assertAlmostEqual(invoice.invoice_line_ids.quantity, 3)
|
||||
|
||||
Reference in New Issue
Block a user