Commit Graph

379 Commits

Author SHA1 Message Date
OCA-git-bot
f880a221b5 contract_show_invoice 10.0.1.0.2 2019-09-10 09:15:55 +00:00
OCA-git-bot
9d8b35fcd9 contract 10.0.4.3.1 2019-09-10 09:15:53 +00:00
oca-travis
6f2af7dff8 [UPD] Update contract_show_invoice.pot 2019-09-10 08:05:37 +00:00
OCA-git-bot
6c1a5d1d42 Merge PR #315 into 10.0
Signed-off-by pedrobaeza
2019-09-10 07:31:44 +00:00
Rafael Blasco
08fc9fd169 Merge pull request #354 from NL66278/10.0-contract_count
[10.0][FIX] contract. Prevent wrong contract count.
2019-09-10 06:52:13 +02:00
Pedro M. Baeza
0644e89ecf [FIX] .travis.yml: Template up to date 2019-08-18 13:21:38 +02:00
sergiocorato
02d165a082 [10.0][FIX] tests not working
[FIX] test

[IMP] test

[FIX] pep8
2019-08-16 10:23:06 +02:00
sergiocorato
3dad78f415 Merge branch '10.0_fix_total_invoiced' of git+ssh://github.com/efatto/contract into 10.0 2019-08-13 15:20:43 +02:00
sergiocorato
de5752d3dc Merge branch '10.0_imp_sequence_journal' of git+ssh://github.com/efatto/contract into 10.0 2019-08-13 15:20:40 +02:00
sergiocorato
7006eb0b92 [FIX] remove bump version 2019-08-13 15:18:23 +02:00
sergiocorato
e1cfee911e [IMP] get account journal default by sequence 2019-08-13 15:15:06 +02:00
Ronald Portier
a666728774 [FIX] contract. Prevent wrong contract count.
Contract count could be wrong if the current date for the user is not the
UTC date.

So a contract created in for instance the Amsterdam timezone just after
midnight, would get maybe the 16th of july as date_start. but
_compute_contract_count would look for contracts valid on the 15th of july.
2019-07-18 11:27:13 +02:00
Maria Sparenberg
d73f0e2404 Translated using Weblate (German)
Currently translated at 100.0% (99 of 99 strings)

Translation: contract-10.0/contract-10.0-contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract/de/
2019-06-28 13:42:36 +00:00
Maria Sparenberg
adafb29ca5 Translated using Weblate (German)
Currently translated at 62.4% (58 of 93 strings)

Translation: contract-10.0/contract-10.0-website_portal_contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-website_portal_contract/de/
2019-06-28 13:42:35 +00:00
OCA Transbot
d6c9ef2632 Update translation files
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: contract-10.0/contract-10.0-contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract/
2019-06-06 00:08:26 +00:00
oca-travis
c7068e4b05 [UPD] Update contract.pot 2019-06-06 00:08:03 +00:00
Ronald Portier
14f3cc2775 [10.0][IMP] contract. Enable automatic invoice generation before invoice date. (#282)
* [IMP] contract. Enable automatic invoice generation before invoice date.

* [IMP] contract pregenerate - improvements after review.
2019-06-06 01:32:08 +02:00
OCA-git-bot
2337ad191c [UPD] addons table in README.md 2019-05-27 14:53:17 +00:00
Maria Sparenberg
06c572a514 Translated using Weblate (German)
Currently translated at 100.0% (4 of 4 strings)

Translation: contract-10.0/contract-10.0-contract_digitized_signature
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_digitized_signature/de/
2019-05-27 14:52:58 +00:00
Pedro M. Baeza
dace58094e Merge pull request #321 from NL66278/10.0-product_contract-fix-recurring
[10.0] [FIX] product_contract. Correctly create contract from template.
2019-05-27 16:52:53 +02:00
Ronald Portier
09245d0e0e [FIX] product_contract. Correctly create contract from template. 2019-05-05 20:21:38 +02:00
sergiocorato
71b886866f [IMP] add sequence in search default journal 2019-04-05 17:55:03 +02:00
Jarmo Kortetjärvi
b6f75686bc Translated using Weblate (Finnish)
Currently translated at 100.0% (10 of 10 strings)

Translation: contract-10.0/contract-10.0-contract_sale_generation
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_sale_generation/fi/
2019-04-03 02:49:28 +00:00
Maria Sparenberg
f4c40aa0da Translated using Weblate (German)
Currently translated at 61.3% (57 of 93 strings)

Translation: contract-10.0/contract-10.0-website_portal_contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-website_portal_contract/de/
2019-04-03 02:49:27 +00:00
Marta Vázquez Rodríguez
d4d48a1a1d Translated using Weblate (Spanish)
Currently translated at 100.0% (7 of 7 strings)

Translation: contract-10.0/contract-10.0-contract_show_invoice
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_show_invoice/es/
2019-04-03 02:49:27 +00:00
Marta Vázquez Rodríguez
cc75967eab Translated using Weblate (Spanish)
Currently translated at 100.0% (5 of 5 strings)

Translation: contract-10.0/contract-10.0-agreement_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-agreement_sale/es/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
429ab3e875 Translated using Weblate (German)
Currently translated at 58.1% (54 of 93 strings)

Translation: contract-10.0/contract-10.0-website_portal_contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-website_portal_contract/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
d11f39acf1 Translated using Weblate (German)
Currently translated at 100.0% (6 of 6 strings)

Translation: contract-10.0/contract-10.0-product_contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-product_contract/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
548191b21f Translated using Weblate (German)
Currently translated at 100.0% (31 of 31 strings)

Translation: contract-10.0/contract-10.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_variable_quantity/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
2bc203deff Translated using Weblate (German)
Currently translated at 100.0% (7 of 7 strings)

Translation: contract-10.0/contract-10.0-contract_show_invoice
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_show_invoice/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
178563a816 Translated using Weblate (German)
Currently translated at 100.0% (10 of 10 strings)

Translation: contract-10.0/contract-10.0-contract_sale_generation
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_sale_generation/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
e5301edfee Translated using Weblate (German)
Currently translated at 100.0% (25 of 25 strings)

Translation: contract-10.0/contract-10.0-contract_payment_auto
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_payment_auto/de/
2019-04-03 02:49:27 +00:00
Maria Sparenberg
183ce045a3 Translated using Weblate (German)
Currently translated at 100.0% (4 of 4 strings)

Translation: contract-10.0/contract-10.0-contract_digitized_signature
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_digitized_signature/de/
2019-04-03 02:49:26 +00:00
Maria Sparenberg
1270a0a772 Translated using Weblate (German)
Currently translated at 100.0% (96 of 96 strings)

Translation: contract-10.0/contract-10.0-contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract/de/
2019-04-03 02:49:26 +00:00
Maria Sparenberg
5579dc8af8 Translated using Weblate (German)
Currently translated at 100.0% (5 of 5 strings)

Translation: contract-10.0/contract-10.0-agreement_sale
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-agreement_sale/de/
2019-04-03 02:49:26 +00:00
Maria Sparenberg
173faccc58 Translated using Weblate (German)
Currently translated at 100.0% (29 of 29 strings)

Translation: contract-10.0/contract-10.0-agreement_account
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-agreement_account/de/
2019-04-03 02:49:26 +00:00
OCA-git-bot
9d74f7faa5 [ADD] icon.png 2019-04-03 02:42:46 +00:00
Maria Sparenberg
f9c3e98a27 Added translation using Weblate (German) 2019-02-22 13:12:11 +00:00
Marta Vázquez Rodríguez
c1c42cde7e Translated using Weblate (Galician)
Currently translated at 100.0% (31 of 31 strings)

Translation: contract-10.0/contract-10.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_variable_quantity/gl/
2019-02-07 16:50:27 +00:00
Marta Vázquez Rodríguez
d58713e52c Translated using Weblate (Galician)
Currently translated at 100.0% (10 of 10 strings)

Translation: contract-10.0/contract-10.0-contract_sale_generation
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_sale_generation/gl/
2019-02-07 11:50:29 +00:00
Marta Vázquez Rodríguez
2bf9f1cd9b Translated using Weblate (Galician)
Currently translated at 100.0% (3 of 3 strings)

Translation: contract-10.0/contract-10.0-contract_recurring_analytic_distribution
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_recurring_analytic_distribution/gl/
2019-02-07 11:50:28 +00:00
Marta Vázquez Rodríguez
e001e4f69d Translated using Weblate (Galician)
Currently translated at 100.0% (4 of 4 strings)

Translation: contract-10.0/contract-10.0-contract_digitized_signature
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_digitized_signature/gl/
2019-02-07 11:50:28 +00:00
Marta Vázquez Rodríguez
864aa139a4 Translated using Weblate (Galician)
Currently translated at 100.0% (29 of 29 strings)

Translation: contract-10.0/contract-10.0-agreement_account
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-agreement_account/gl/
2019-02-07 11:50:27 +00:00
Marta Vázquez Rodríguez
38f5690413 Translated using Weblate (Spanish)
Currently translated at 100.0% (31 of 31 strings)

Translation: contract-10.0/contract-10.0-contract_variable_quantity
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract_variable_quantity/es/
2019-02-04 14:50:18 +00:00
Marta Vázquez Rodríguez
bec24343af Translated using Weblate (Spanish)
Currently translated at 100.0% (96 of 96 strings)

Translation: contract-10.0/contract-10.0-contract
Translate-URL: https://translation.odoo-community.org/projects/contract-10-0/contract-10-0-contract/es/
2019-02-04 14:50:18 +00:00
OCA Transbot
2026bcca3a Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
2019-01-24 19:48:28 +00:00
oca-travis
262c746580 [UPD] Update contract.pot 2019-01-24 19:48:04 +00:00
Pedro M. Baeza
fcf510fae3 Merge pull request #266 from Tecnativa/10-contract-optimize
[10.0][IMP] contract: Performance boost 🚀
2019-01-24 19:44:53 +01:00
Jairo Llopis
173b2b2db2 [10.0][IMP] contract: Performance boost 🚀
With this patch we save about 83% of the execution time when generating invoices in batch.

# Optimizations made

## Recompute once at the end of the batch

This part avoids recomputing many fields per record. Instead, global recomputations are triggered at the end of the block:

```python
with _self.env.norecompute():
    ...
    invoices.compute_taxes()
_self.recompute()
```

Notice the explicit call to `compute_taxes()`, which was explicit before also, but it was done once per invoice, losing batch-computing boost.

## Disabling prefetch for extra fields

It's done in this part:

```python
_self = self.with_context(prefetch_fields=False)
```

Prefetching makes sense when we are going to use a lot of fields for a model that has only a few.

In our case, we are using not much fields, but the models involved have lots of them.

This produces more queries to get those fields, but the queries are noticeably smaller. At the end of the day, it saves a lot of time, which is what matters.

## Disabling track mail creation

This part does it:

```diff
         ctx.update({
+            'mail_notrack': True,
             'next_date': next_date,
```

It makes that when creating invoices, we don't create the "Invoice created" message.

## Precomputing price

Obtaining `price_unit` from `contract.recurring_invoice_line_ids` was quite expenisve in terms of CPU, and it was being made once per line, each one in a different context, which means also a different cache.

Instead of that, lines now share a single context, and are computed before starting the batch.

This code precomputes stuff:

```python
# Precompute expensive computed fields in batch
recurring_lines = _self.mapped("recurring_invoice_line_ids")
recurring_lines._fields["price_unit"].determine_value(recurring_lines)
```

And the usage of 2 different environments done inside `_create_invoice()` (`self` and `_self`) guarantee that the invoices are filled with the correct data, but also that the lines use the cached precomputed value instead of having to compute it each time.

# Performance gain

According to my tests, generating 10 invoices took 62 seconds before, and it takes about 18 seconds now.
2019-01-24 13:30:49 +00:00
OCA Transbot
43accdc655 Update translation files
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
2019-01-24 04:04:16 +00:00