-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[15.0][FIX] sale_timesheet_rounded: avoid recomputing rounded amounts…
… when posting an invoice
- Loading branch information
1 parent
8da4328
commit 67e584a
Showing
8 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import models | ||
from .hooks import pre_init_hook | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import account_analytic_line | ||
from . import project_project | ||
from . import sale | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
|
||
from odoo import models | ||
|
||
|
||
class AccountMove(models.Model): | ||
|
||
_inherit = "account.move" | ||
|
||
def _post(self, soft=True): | ||
# We must avoid the recomputation of the unit amount rounded called by | ||
# the compute_project_id (especially when project has not been changed) | ||
return super(AccountMove, self.with_context(timesheet_no_recompute=True))._post( | ||
soft=soft | ||
) | ||
|
||
def unlink(self): | ||
return super( | ||
AccountMove, self.with_context(timesheet_no_recompute=True) | ||
).unlink() | ||
|
||
def button_cancel(self): | ||
return super( | ||
AccountMove, self.with_context(timesheet_no_recompute=True) | ||
).button_cancel() | ||
|
||
def button_draft(self): | ||
return super( | ||
AccountMove, self.with_context(timesheet_no_recompute=True) | ||
).button_draft() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import sale_make_invoice_advance |
21 changes: 21 additions & 0 deletions
21
sale_timesheet_rounded/wizard/sale_make_invoice_advance.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Camptocamp SA | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) | ||
|
||
from odoo import models | ||
|
||
|
||
class SaleAdvancePaymentInv(models.TransientModel): | ||
|
||
_inherit = "sale.advance.payment.inv" | ||
|
||
def create_invoices(self): | ||
"""Override method from sale/wizard/sale_make_invoice_advance.py | ||
When the user want to invoice the timesheets to the SO | ||
up to a specific period then we need to recompute the | ||
qty_to_invoice for each product_id in sale.order.line, | ||
before creating the invoice. | ||
""" | ||
return super( | ||
SaleAdvancePaymentInv, self.with_context(timesheet_no_recompute=True) | ||
).create_invoices() |