-
-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[16.0][FIX] account_move_line_purchase_info: do not consider stock en…
…try lines on revaluations Up to now, stock entries were considered in the revaluation process as they were stored on field invoice_lines. To avoid that we introduced a dedicated field to manage stock entries and avoid taking them into account in the revaluation odoo core process.
- Loading branch information
1 parent
a8c69ea
commit c98562c
Showing
11 changed files
with
114 additions
and
25 deletions.
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
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
19 changes: 19 additions & 0 deletions
19
account_move_line_purchase_info/migrations/16.0.2.0.0/post-migration.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,19 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
purchase_orders = env["purchase.order"].search([("state", "=", "purchase")]) | ||
for order in purchase_orders: | ||
valued_lines = order.order_line.invoice_lines.filtered( | ||
lambda l: l.product_id | ||
and l.product_id.cost_method != "standard" | ||
and (not l.company_id.tax_lock_date or l.date > l.company_id.tax_lock_date) | ||
) | ||
svls, _amls = valued_lines._apply_price_difference() | ||
|
||
if svls: | ||
svls._validate_accounting_entries() | ||
|
||
bills = order.invoice_ids.filtered(lambda bill: bill.state == "posted") | ||
bills._stock_account_anglo_saxon_reconcile_valuation() |
31 changes: 31 additions & 0 deletions
31
account_move_line_purchase_info/migrations/16.0.2.0.0/pre-migration.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,31 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
ALTER TABLE account_move_line | ||
ADD COLUMN IF NOT EXISTS purchase_line_id_oca INTEGER; | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE account_move_line | ||
SET purchase_line_id_oca = purchase_line_id; | ||
""", | ||
) | ||
|
||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE account_move_line | ||
SET purchase_line_id = NULL | ||
FROM account_move | ||
WHERE account_move_line.move_id = account_move.id | ||
AND account_move.move_type = 'entry'; | ||
""", | ||
) |
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
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
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
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