Commit Graph

51 Commits

Author SHA1 Message Date
sbejaoui
bf8845d683 [12.0][IMP] - extend contract line at renewal 2021-11-09 10:08:00 +07:00
sbejaoui
2cd93a819c [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-11-09 10:08:00 +07:00
sbejaoui
0ff7a4cfd1 [12.0][FIX] - raise an error when next invoice date before the last date invoiced 2021-11-09 10:08:00 +07:00
Bejaoui Souheil
4fb5f8bddf [REF] contract: simplify _get_period_to_invoice 2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
b7b993a153 [REF] contract: rename _get_recurring_next_date as get_next_invoice_date
It is easier to understand. Also make it public.
2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
07a13242f3 [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
901d934ed8 [REF] contract: make recurring_invoicing_offset a computed field
In preparation to making it user modifiable.
2021-11-09 10:08:00 +07:00
sbejaoui
3257a058f4 [FIX] contract: Improve unit tests 2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
5636fa9894 [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
8d9c4a3df5 [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
b7acd45d83 [FIX] contract: add missing dependency in computed field 2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
a5983e2eea [REF] contract: re-add _compute_first_recurring_next_date
For backward compatibility
2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
f1c5ad37ca [REF] contract: refactor _update_recurring_next_date
Reuse the logic that is now fully located in _get_recurring_next_date.
2021-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
f717692a25 [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
01fe31de0e [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
7a24716cda [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
6c12c3636e [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-11-09 10:08:00 +07:00
Stéphane Bidoul (ACSONE)
ab20ff9d3f [REF] contract: rename misnamed methods 2021-11-09 10:08:00 +07:00
sbejaoui
2ace7aee59 [12.0][FIX] - Fix performance issue on contract line read
multi-company record rules on contract line causes performance issue
2021-11-09 10:07:59 +07:00
Pedro M. Baeza
dfd24523a7 [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-11-09 10:07:59 +07:00
sbejaoui
63dc0c2e09 [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-11-09 10:07:59 +07:00
Thomas Binsfeld
5383d0b68d [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-11-09 10:07:59 +07:00
Thomas Binsfeld
bfe3154377 [REF] Contract: split from analytic account 2021-11-09 10:07:59 +07:00
sbejaoui
1250997cd6 [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-11-09 10:07:59 +07:00
sbejaoui
280727e5cf [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-11-09 10:07:59 +07:00
sbejaoui
16d460fde1 [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-11-09 10:07:59 +07:00
sbejaoui
51c1eb35d8 [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-11-09 10:07:59 +07:00
sbejaoui
101a6f613b [REF] - add _get_next_invoiced_period method 2021-11-09 10:07:59 +07:00
sbejaoui
7d69fcb386 [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-11-09 10:07:59 +07:00
sbejaoui
671086cc72 [FIX] - recurring_next_date is required if date_end is null 2021-11-09 10:07:59 +07:00
sbejaoui
5c32e00eba [IMP] - Should be able to stop a past contract line 2021-11-09 10:07:59 +07:00
sbejaoui
b3ebba4aa1 [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-11-09 10:07:59 +07:00
sbejaoui
fdbedb602d [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-11-09 10:07:59 +07:00
sbejaoui
69c33a8741 [FIX] - filter by termination_notice for contract line to renew 2021-11-09 10:07:59 +07:00
sbejaoui
654ace176e [FIX] - renew only recurring_invoices contract 2021-11-09 10:07:59 +07:00
sbejaoui
f7b440f07f [FIX] - do not copy last_date_invoiced on plan_successor 2021-11-09 10:07:59 +07:00
sbejaoui
86e09d723d [12.0][IMP] - check invoice line vals before assignment
[FIX] - Fix unit tests.
2021-11-09 10:07:59 +07:00
sbejaoui
ee91a0fd7a [FIX] - default value for active field in contract line
[FIX] - fix flake8
2021-11-09 10:07:59 +07:00
sbejaoui
8e56200b56 [FIX] - as date_start is required, constraints on it become useless
[FIX] - for finished contract _get_lines_to_invoice should return False
2021-11-09 10:07:59 +07:00
Thomas Binsfeld
2b80ed5696 [REF] Contract: invoice creation
[FIX] - Fix typo

[IMP] - date start required for contract line

[REF] Gitignore: .eggs

[REF] Contract Unit Tests: base the cron check on invoice lines instead of invoices
2021-11-09 10:07:59 +07:00
sbejaoui
b8101fd2cd [IMP] - archive contract_line on contract archive 2021-11-09 10:07:59 +07:00
sbejaoui
2d917d03bd [FIX] - contract recurring_next_date ignore canceled lines
[FIX] - fix _get_invoiced_period if recurring_next_date manually updated
2021-11-09 10:07:59 +07:00
sbejaoui
7ca1baf0c9 [FIX] - check date_start before onchange 2021-11-09 10:07:59 +07:00
sbejaoui
235124f118 [IMP] - don't allow to unlink uncnaceled contrac line 2021-11-09 10:07:59 +07:00
sbejaoui
0d7579f37e [IMP] - store last_date_invoiced on contract_line
Improve CRITERIA_ALLOWED_DICT

[IMP] - code improvement

[IMP] - Use last_date_invoiced to set marker in invoice description

[IMP] - add migration script to init last_day_invoiced and some other improvement

[FIX] - a contract line suspended should start a day after the suspension end
2021-11-09 10:07:59 +07:00
sbejaoui
b46cb904ec [IMP] - improve cancel/uncancel process
[FIX] - Test if start_date is set before compute

[FIX] - date_end include in the period in auto_renew case

[FIX] - in suspension case, contract line should start a day after the end

[IMP] - confirm message on contract line cancel
2021-11-09 10:07:59 +07:00
sbejaoui
ee3baca89d [FIX] - fix stop_plan_successor case 5
contract line start in the suspension period and end after it
2021-11-09 10:07:59 +07:00
sbejaoui
07f0f44c05 [IMP] - Add primary views for contract
[IMP] - don't use related filed for partner_id and pricelist_id
2021-11-09 10:07:58 +07:00
sbejaoui
65147775ca [FIX] - invoice last period for post-paid case 2021-11-09 10:07:58 +07:00
sbejaoui
b5c38415d4 [12.0][IMP] - Add strat/stop wizard to contract line
[12.0][IMP] - Add pause button to contract line

[IMP] - Add state filed in contract line form

[FIX] - stop don't change date_end for finished contract line

[IMP] - Change contract line buttons visibility

Add renewal process with termination notice

[FIX] - don't consider stop_date If it is after the contract line end_date

[IMP] - consider more cases in stop_plan_successor

[IMP] - cancel upcoming line on stop

[IMP] - Chnage next invoice date on un-cancel

[IMP] - Post message in contract on contract line actions

[IMP] - check contract line overlap
2021-11-09 10:07:58 +07:00