-
-
Notifications
You must be signed in to change notification settings - Fork 776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][FIX] account_move_line_purchase_info: do not consider stock entry lines on revaluations #2018
Open
AlexPForgeFlow
wants to merge
1
commit into
OCA:16.0
Choose a base branch
from
ForgeFlow:16.0-imp-account_move_line_purchase_info
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[16.0][FIX] account_move_line_purchase_info: do not consider stock entry lines on revaluations #2018
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||
---|---|---|---|---|---|---|
|
@@ -33,6 +33,13 @@ This module will add the purchase order line to journal items. | |||||
The ultimate goal is to establish the purchase order line as one of the key | ||||||
fields to reconcile the Goods Received Not Invoiced accrual account. | ||||||
|
||||||
Field purchase_line_id_oca it's necessary. In Odoo >=16 automatic | ||||||
revaluation for a product with FIFO costing method only works if invoice | ||||||
lines related to a purchase order line do not include stock journal items. | ||||||
To aviod that purchase_line_id_oca includes invoice and stock journal items, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
and we keep Odoo field invoice_lines just with bill lines. | ||||||
- Check issue https://github.com/OCA/account-financial-tools/issues/2017 | ||||||
|
||||||
**Table of contents** | ||||||
|
||||||
.. contents:: | ||||||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
|
@@ -9,10 +8,11 @@ | |
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ | ||
:Copyright: This stylesheet has been placed in the public domain. | ||
|
||
Default cascading style sheet for the HTML output of Docutils. | ||
Despite the name, some widely supported CSS2 features are used. | ||
|
||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
customize this style sheet. | ||
|
@@ -275,7 +275,7 @@ | |
margin-left: 2em ; | ||
margin-right: 2em } | ||
|
||
pre.code .ln { color: grey; } /* line numbers */ | ||
pre.code .ln { color: gray; } /* line numbers */ | ||
pre.code, code { background-color: #eeeeee } | ||
pre.code .comment, code .comment { color: #5C6576 } | ||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } | ||
|
@@ -301,7 +301,7 @@ | |
span.pre { | ||
white-space: pre } | ||
|
||
span.problematic { | ||
span.problematic, pre.problematic { | ||
color: red } | ||
|
||
span.section-subtitle { | ||
|
@@ -373,6 +373,12 @@ <h1 class="title">Account Move Line Purchase Info</h1> | |
<p>This module will add the purchase order line to journal items.</p> | ||
<p>The ultimate goal is to establish the purchase order line as one of the key | ||
fields to reconcile the Goods Received Not Invoiced accrual account.</p> | ||
<p>Field purchase_line_id_oca it’s necessary. In Odoo >=16 automatic | ||
revaluation for a product with FIFO costing method only works if invoice | ||
lines related to a purchase order line do not include stock journal items. | ||
To aviod that purchase_line_id_oca includes invoice and stock journal items, | ||
and we keep Odoo field invoice_lines just with bill lines. | ||
- Check issue <a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/2017">https://github.com/OCA/account-financial-tools/issues/2017</a></p> | ||
<p><strong>Table of contents</strong></p> | ||
<div class="contents local topic" id="contents"> | ||
<ul class="simple"> | ||
|
@@ -423,7 +429,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2> | |
<div class="section" id="maintainers"> | ||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2> | ||
<p>This module is maintained by the OCA.</p> | ||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> | ||
<a class="reference external image-reference" href="https://odoo-community.org"> | ||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /> | ||
</a> | ||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use.</p> | ||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.