2 related fixes:
- When removing an asset line depreciation move, we have to pass it
first to draft, or we won't be able to remove it even with the
context.
- When removing a move, the check for removing the linked asset should
be only for purchase documents, not for "not sale" documents.
[FIX] new line
[FIX] new line
[FIX] without openupgrade
[FIX] without openupgrade
[FIX] without openupgrade
[FIX] without openupgrade
[FIX] without openupgrade
If the assets are created before posting the invoice, they wouldn't have a name and the "code" field of the assets will be empty, but they would have the invoice name.
Steps to reproduce the problem:
* Go to assets view
* Group by profile
* Unfold a group and click on an asset
* Click on "Journal Entries" smart-button
* Go back to the asset list
* Click again on the same asset (or another).
* Click on "Journal Entries" smart-button
Current behavior:
Error saying "KeyError: 'profile_id'"
Expected behavior:
No error
The cause for this is that Odoo stores in the context the key `group_by` with the
value `profile_id` in the specified chain of steps. That context entry is used for
grouping records in the list, and system tries to group the journal entries also
by that field, which doesn't exists in the other model, and thus the error.
We avoided it copying the context to be passes and leaving out that entry.
* There's no need of forcing to create such records if your fiscal years are regular ones.
* FY date range computation duplicates code that is already on core.
* DummyFY is a good idea, but was not used at all. Now it is.
This way, other method_time mechanism like localization ones is able to overwrite it.
You also got an error of variable `number` not set due to previous code. Although no
alternate implementation for a new method_time, now you don't have any error,
fallbacking to standard proportional repartition.