Commit Graph

95 Commits

Author SHA1 Message Date
OCA-git-bot
e4e520ab2c Merge PR #821 into 14.0
Signed-off-by leemannd
2023-07-10 09:15:37 +00:00
Víctor Martínez
6be12f4eb1 [FIX] contract: Set fixed date to check test correctly.
We need to set a fixed date for teststest_check_month_name_marker to check against
the month of the date we are set (otherwise it would check against the month of today).
2023-06-23 12:29:26 +02:00
stenex
7b896a0d5f [IMP] Add INVOICEMONTHNAME marker to line description 2023-05-11 10:12:27 +02:00
Mourad
b793cf6356 [MIG] product_contract: Migration to 14.0 2023-04-03 11:23:39 +02:00
Alexis de Lattre
000ad9eabb [FIX] Add check_company=True on contracts and contract lines
Add check_company=True in field definition and
[('company_id', '=', company_id)] in the domain (in view or in field definition)
2023-02-26 23:01:43 +01:00
OCA-git-bot
5e3ba80e1d Merge PR #841 into 14.0
Signed-off-by pedrobaeza
2023-01-31 15:07:46 +00:00
Víctor Martínez
6c1a3d63f0 [IMP] contract: Set fixed start dates in test contracts 2022-12-01 13:33:26 +01:00
Víctor Martínez
848ac3166a [IMP] contract: Set invoice_user_id field with Form() to apply the correct values of other fields (team_id for example).
TT39934
2022-10-18 09:00:14 +02:00
Michael Tietz
14bf20ec8f [FIX] contract unittest test_contract.py adding tagged('post_install', '-at_install') 2022-09-13 13:34:50 +02:00
Denis Roussel
c2459c481b [14.0][FIX] contract: Compute correctly the recurring next date at end 2022-06-17 10:43:59 +02:00
Maximilien TANTIN
823beabde3 [contract] Set uom as relevant parameter to calculate price unit 2022-05-13 16:58:54 +02:00
OCA-git-bot
517170d23f Merge PR #772 into 14.0
Signed-off-by pedrobaeza
2022-02-23 22:25:57 +00:00
OCA-git-bot
2c632f79ea Merge PR #783 into 14.0
Signed-off-by pedrobaeza
2022-02-16 14:51:34 +00:00
Ernesto Tejeda
57023d7845 [IMP] contract: remove l10n_generic_coa dependencie 2022-02-14 16:28:12 -05:00
Jean-Charles Drubay
a8b01fc0b7 ADJ: When generating invoices from the Wizard to create invoices manually, reraise any UserError with information about which contract triggered the exception to facilitate the investigation by accountants in case invoices are not generated automatically. 2022-02-14 22:16:26 +01:00
Denis Roussel
6998f804ba [14.0][IMP] contract: Improve multi-company tests / don't break former tests structure 2022-01-26 09:04:31 +01:00
Denis Roussel
f33112c2fc [14.0][IMP] contract: Simplify test flow 2022-01-26 09:04:31 +01:00
Denis Roussel
e0b44cfa39 [14.0][IMP] contract: Remove deprecated domain in onchange 2022-01-25 12:00:02 +01:00
Denis Roussel
57388a415d [IMP] contract: Improve tests
Adds multi company tests
2022-01-21 11:42:47 +01:00
João Marques
5fcd198471 [FIX] contract: Fix invoice creation and salesperson assignment
In v13, the `user_id` field is a related field to `invoice_user_id`, that defaults to the environment user (`self.env.user`).
Therefore, if we try to create an invoice just by passing `user_id`, it would be overwritten by the default computation of `invoice_user_id`.
This fixes it by passing the correct field and data.

TT31715
2021-09-10 13:31:14 +01:00
Francisco Ivan Anton Prieto
85fda61634 [MIG] contract: Migration to 14.0 2021-04-02 13:49:16 +02:00
Francisco Ivan Anton Prieto
5e22708411 [IMP] contract: black, isort, prettier 2021-04-01 14:03:12 +02:00
Víctor Martínez
a6bafcd4d3 [FIX] contract: Changed modification_mail auto to appear like email and not internal comment 2021-04-01 13:53:04 +02:00
Víctor Martínez
553374a8dc [FIX] contract: Error in test_contract_invoice_followers 2021-04-01 13:53:04 +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
Víctor Martínez
01a142e6d3 [FIX] contract: Modification mail + Auto-create follower in contract creation related to partner_id
Co-Authored-By: Pedro M. Baeza <pedro.baeza@tecnativa.com>
2021-04-01 13:53:04 +02:00
Víctor Martínez
d7dee0c1f8 [IMP] contract: Add contract modification 2021-04-01 13:53:04 +02:00
Víctor Martínez
ea928628bb [IMP] contract: Portal 2021-04-01 13:53:03 +02:00
Víctor Martínez
828103000f [IMP] contract: Add followers to invoices created 2021-04-01 13:53:03 +02:00
Denis Roussel
5ce7e73525 [13.0][FIX] contract: Recompute recurring next date
After invoice creation, the recurring next date has to be recomputed
in order to get good values
2021-04-01 13:53:03 +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
Pedro M. Baeza
9f82dd2d1a [IMP] contract: Allow to set a manual currency
Done through an extra field + inverse in the existing compute. This way, we have
the flexibility of auto-remove custom value if it matches the computed one + we don't
need extra changes in the rest of the code.
2021-04-01 13:53:03 +02:00
Jairo Llopis
392c27a161 [FIX] contract: do not die if modified partner has contracts in several companies
In a multicompany scenario where a contact belongs to a company and has contracts in several companies, if the user goes to the contact to edit anything, when saving, it will trigger the recomputation of the `commercial_partner_id` field, which gets populated to all the related contracts, and will undeniably fail with an `AccessError`.

A simple test is provided that, without the fix, fails like this:

```
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: ERROR: test_multicompany_partner_edited (odoo.addons.contract.tests.test_contract.TestContract)
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: ` Editing a partner with contracts in several companies works.
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: Traceback (most recent call last):
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/auto/addons/contract/tests/test_contract.py", line 2513, in test_multicompany_partner_edited
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: `     'parent_id': parent_partner.id,
2020-06-25 07:21:24,859 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/auto/addons/partner_autocomplete/models/res_partner.py", line 183, in write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     res = super(ResPartner, self).write(values)
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/custom/src/odoo/odoo/addons/base/models/res_partner.py", line 570, in write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     result = result and super(Partner, self).write(vals)
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 321, in write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     result = super(MailThread, self).write(values)
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/auto/addons/mail/models/mail_activity.py", line 613, in write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     return super(MailActivityMixin, self).write(vals)
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3381, in write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     self.recompute()
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 5308, in recompute
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     target._write(dict(vals))
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3433, in _write
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     self.check_access_rule('write')
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3081, in check_access_rule
2020-06-25 07:21:24,860 33 ERROR devel odoo.addons.contract.tests.test_contract: `     + ' - ({} {}, {} {})'.format(_('Records:'), invalid.ids[:6], _('User:'), self._uid)
2020-06-25 07:21:24,861 33 ERROR devel odoo.addons.contract.tests.test_contract: ` odoo.exceptions.AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Contract, Operation: write) - (Records: [101], User: 12)', None)
```

@Tecnativa TT24482
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
Pedro M. Baeza
18eac7950f [FIX+IMP] contract: improve test coverage with new sections + fix search method 2021-04-01 13:53:03 +02:00
sbejaoui
3ff689a01d [IMP] - contract termination 2021-04-01 13:53:03 +02:00
sbejaoui
789d7260a6 [12.0][IMP] - Add an action for contracts manual invoicing
It happen that a company has to trigger the invoicing action to generate invoices before
the scheduled date (to print and prepare invoices documents, check invoices, etc.).
This requires technical access for end users with the risk that this represents.

This commit adds a new wizard to run the invoicing action for a given date with a helper
to see and check the contract that will be invoiced. When the manual action is called,
the system displays all created invoices.

[12.0][IMP] - log the manual invoice action in contract chatter

[IMP] - Add alink to the invoice in contract message at manual invoicing

[IMP] - Improve code

[FIX] - log message for invoice creation only when there is an invoice

[IMP] - split the manual invoice menu into to menus sale & purhcase

[IMP] - hide invoice button if there is nothing to invoice
2021-04-01 13:53:03 +02:00
sbejaoui
f54661e53e [12.0][IMP] - Add failing test for wrong invoicing date after contract line stop 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
7e55756ddd [12.0][IMP] - Add failing test for next invoice date before the last date invoiced 2021-04-01 13:53:02 +02:00
sbejaoui
bfa220bcb8 [IMP] contract: add unit test for different combinations for next invoicing period 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)
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)
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)
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