Commit Graph

66 Commits

Author SHA1 Message Date
Francisco Ivan Anton Prieto
5e22708411 [IMP] contract: black, isort, prettier 2021-04-01 14:03:12 +02:00
Denis Roussel
3f7449159f [13.0][FIX] contract: Impossible to create invoices from contract lines as section 2021-04-01 13:53:04 +02:00
Pedro M. Baeza
3374384101 [IMP+REF] contract: Allow to set recurrency at header level
Big refactoring for allowing to define recurrency at header level for simplifying
the use of the module for most of the cases where you don't need different
recurrency at line level.
2021-04-01 13:53:03 +02:00
Pedro M. Baeza
fc4eb98c74 [MIG] contract: Migration to 13.0
- Standard procedure
- Adapt invoice creation to new account.move
- Tests adapted
2021-04-01 13:53:03 +02:00
Pedro M. Baeza
a2f71595bf [IMP] : black, isort, prettier 2021-04-01 13:53:03 +02:00
sbejaoui
79efc8d59c [IMP] - Contract: add new recurring_rule_type quarterly and semesterly 2021-04-01 13:53:03 +02:00
Ernesto Tejeda
cd93b6a114 [FIX] contract: Select the correct sections/notes to be invoiced 2021-04-01 13:53:03 +02:00
Pedro M. Baeza
18eac7950f [FIX+IMP] contract: improve test coverage with new sections + fix search method 2021-04-01 13:53:03 +02:00
Ernesto Tejeda
493501e6c7 [IMP] contract: add section and notes in contract line 2021-04-01 13:53:03 +02:00
sbejaoui
3ff689a01d [IMP] - contract termination 2021-04-01 13:53:03 +02:00
Ernesto Tejeda
e9e3284274 [IMP] contract: add analytic_tag_ids field in contract lines 2021-04-01 13:53:03 +02:00
Pedro M. Baeza
39becb9dc9 [IMP] contract: remove redundant method
I have detected a method that was created as redundant and with the same
technique used when preparing the line values, so better to have
everything together in the same method instead of having it spread.
2021-04-01 13:53:03 +02:00
Pedro M. Baeza
46b8715806 [FIX] contract: Handle properly multi-company setups
If you have contracts in several companies, cron will create all of them, but
property fields will be populated with incorrect data as the taken company is
the main from the cron user (usually admin).
2021-04-01 13:53:03 +02:00
sbejaoui
d39629a1ef [12.0][FIX] - stop update recurring_next_date 2021-04-01 13:53:03 +02:00
sbejaoui
b7927f67de [IMP] - improve code: unify methods argument _renew_create_line and _renew_extend_line 2021-04-01 13:53:03 +02:00
sbejaoui
57f5df2a03 [12.0][IMP] - extend contract line at renewal 2021-04-01 13:53:02 +02:00
sbejaoui
becaad164f [12.0][IMP] - add new option: create_new_line_at_contract_line_renew
Add a company config option to decide whether to create or to extend contract
line at renew action
2021-04-01 13:53:02 +02:00
sbejaoui
a5ae569e4f [12.0][FIX] - raise an error when next invoice date before the last date invoiced 2021-04-01 13:53:02 +02:00
Bejaoui Souheil
313bacff0f [REF] contract: simplify _get_period_to_invoice 2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
8061e3f0cd [REF] contract: rename _get_recurring_next_date as get_next_invoice_date
It is easier to understand. Also make it public.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
809c90c676 [REF] contract: make get_next_period_date_end public
Make it public because it is the core logic of the module.
Also, clarify that recurring_invoicing_type
and recurring_invoicing_offset are needed only when
we want the next period to be computed from a
user chosen next invoice date.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
198060511c [REF] contract: make recurring_invoicing_offset a computed field
In preparation to making it user modifiable.
2021-04-01 13:53:02 +02:00
sbejaoui
d74f65ff97 [FIX] contract: Improve unit tests 2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
7649f5b385 [IMP] contract: support pre-paid for monthlylastday
monthlylastday is (almost) not a special case anymore \o/.
montlylastday is simply a montly period where the
periods are aligned on month boundaries.
The last bit of special casing is that postpaid generates
invoice the day after the last dasy of the period, except
for monthlylastday where the invoice is generated on the
last day of the period. This last exception will disappear
when we put the offset under user control.

This is a breaking change because the post-paid/pre-paid
mode becomes relevant for monthlylastday invoicing.
The field becomes visible in the UI. Code that generate
monthlylastday contract lines must now correctly set
the pre-paid/post-paid mode too. Some tests have had
to be adapted to reflect that.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
4b2f0d2e25 [REF] contract: remove one monthlylastday special case
get_relative_delta now works the same for all recurring rules.
Move the special case handling to _init_last_date_invoiced
which is used only for migration.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
4bfe8cd56e [FIX] contract: add missing dependency in computed field 2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
e2fa625aeb [REF] contract: re-add _compute_first_recurring_next_date
For backward compatibility
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
92cb491f6b [REF] contract: refactor _update_recurring_next_date
Reuse the logic that is now fully located in _get_recurring_next_date.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
ad696645f8 [REF] contract: refactor _get_period_to_invoice
Move the part of the logic that compute the next
period depending on the chosen next invoice date
to _get_next_period_date_end.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
ea235974b8 [IMP] contract: add next period start/end fields
Add two computed field showing the next period
start and end date. This improve the UX and will
enable further simplifications in the code.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
967023c31b [REF] contract: handle max_date_end in _get_recurring_next_date
This concentrates all next date calculation
logic in one place, and will allow further simplifications.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
e63ad7d15f [REF] contract: clarify _get_recurring_next_date
First compute the next period end date,
then derive the next invoice date from the next
period stard and end date.
2021-04-01 13:53:02 +02:00
Stéphane Bidoul (ACSONE)
87babeba9f [REF] contract: rename misnamed methods 2021-04-01 13:53:02 +02:00
sbejaoui
cb5f4c21fa [12.0][FIX] - Fix performance issue on contract line read
multi-company record rules on contract line causes performance issue
2021-04-01 13:53:02 +02:00
Pedro M. Baeza
a2cd6455ad [FIX+IMP+MIG] contract: Several refinements:
* Remove incorrect oldname attributes.
* Add filter on partners for running contracts (+ a support o2m field for that).
* Cover more tables in model renaming + cleaner code using a loop.
* Don't copy contract lines, but rename table + copy contract records on pre.
* Contract code is now populated to "Reference/Description" field in invoice.
* Order on new contract model has been restored to the same as old analytic accounts.
2021-04-01 13:53:02 +02:00
sbejaoui
f55b537d08 [IMP] - Make one migration from 12.0.1 to 12.0.4
[RMV] - Remove empty file

[IMP] - Update no_update cron after migration

[IMP] - move contract template recurrence info to line level

[FIX] - Fix contract line model description

[IMP] - Link contracts to analytic accounts

[FIX] - Fix pylint

[IMP] - Move chatter and attachments from analytic account to contract

[IMP] - Move account_analytic_id to contract line level

[IMP] - Improve version check in migration script

[IMP] - Move contracts followers from analytic accounts

[ADD] - Add mail.activity.mixin to contract.contract model

remove data drop from migration scripts

[12.0][FIX] - Fix _init_last_date_invoiced

fix flake8

[ADD] - Update contributors list
2021-04-01 13:53:02 +02:00
Thomas Binsfeld
c770e97adb [REF] Contract Sale Invoicing: split from analytic account
[REF] Contract Sale Invoicing: update translations

[IMP] - Assert that the predecessor is available for new link at uncancel

[RMV] - remove usless changes

[RMV] - Remove usless field recurring_invoices

after the total isolation between contract model and account analytic one.
recurring_invoices which was used to mark analytic account as contract became usless

[IMP] - P3 syntax

[IMP] - use @openupgrade.migrate() and openupgrade.logged_query

[IMP] - drop transient table in migration script
2021-04-01 13:53:02 +02:00
Thomas Binsfeld
3ca769e079 [REF] Contract: split from analytic account 2021-04-01 13:53:02 +02:00
sbejaoui
107dbc65d6 [IMP] - A canceled contract line can't be set to auto-renew
[REF] Contract: pep8

[IMP] Contract: update USAGE section of README

[IMP]call onchange_is_auto_renew when changing template
2021-04-01 13:53:02 +02:00
sbejaoui
5c8c875b61 [FIX] - don't play onchange date_start for old lines on contract template change
[FIX] - Fix stop post message

[FIX] - Fix sale_contract_count should count all partner contract

[FIX] - set recurring_next_date to False if contract line stoped at last date invoiced

[FIX] - Group by next_invoice also considers dates in the past
2021-04-01 13:53:02 +02:00
sbejaoui
5248e17bab [FIX] - Onchange contract line don't reste contract lines
[FIX] - Rename _get_invoiced_period to _get_period_to_invoice

[ADD] - Add stop_at_date_end to _get_period_to_invoice

[FIX] - Remove useless filter
2021-04-01 13:53:02 +02:00
sbejaoui
c9ef02df2b [REF] - add method to get quantity to invoice
the contract line quantity can be in some use cases variable, to simplify
the way it is changed we add a new method _get_quantity_to_invoice.
2021-04-01 13:53:02 +02:00
sbejaoui
c7a34a7dc6 [REF] - add _get_next_invoiced_period method 2021-04-01 13:53:02 +02:00
sbejaoui
0af00f2d6d [ADD] - Add more value for auto_renew_rule_type
[REF] - refactoring for compute_first_date_end

[RMV] - remove auto_renew_rule_type option monthlylastday

[IMP] - rename manual_renew_needed label

[IMP] - use get_product_multiline_description_sale to get contract line description
2021-04-01 13:53:02 +02:00
sbejaoui
21d1ef010c [FIX] - recurring_next_date is required if date_end is null 2021-04-01 13:53:02 +02:00
sbejaoui
ae2bf92694 [IMP] - Should be able to stop a past contract line 2021-04-01 13:53:02 +02:00
sbejaoui
c2555ea18a [IMP] - Replace is_suspended flag by manual_renew_needed
Add a computed field for the first date of the termination notice period

Adapt state compute and search method

[IMP] - Improve unit tests
2021-04-01 13:53:02 +02:00
sbejaoui
46133d4175 [IMP] - Link invoice line to contract lines
[IMP] - Add index on contract line

[IMP] - Add is_suspended flag and _search_state

[IMP] - Add is_suspended flag to stop contract line
2021-04-01 13:53:02 +02:00
sbejaoui
24027f0918 [FIX] - filter by termination_notice for contract line to renew 2021-04-01 13:53:02 +02:00
sbejaoui
5ffb2cffd8 [FIX] - renew only recurring_invoices contract 2021-04-01 13:53:02 +02:00