Skip to content
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

[14.0][ADD] account_invoice_update_stock_valuation #1579

Open
wants to merge 3 commits into
base: 14.0
Choose a base branch
from

Conversation

chafique-delli
Copy link

@chafique-delli chafique-delli commented Oct 16, 2023

@chafique-delli chafique-delli marked this pull request as draft October 16, 2023 20:29
@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch 2 times, most recently from 9989efe to c28eca6 Compare October 17, 2023 14:41
@chafique-delli chafique-delli marked this pull request as ready for review October 17, 2023 14:43
@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch from c28eca6 to 9d3165e Compare November 24, 2023 12:29
@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch from 9d3165e to c991f81 Compare November 24, 2023 12:30
_inherit = "account.move.line"

stock_valuation_ok = fields.Boolean(
string="Stock valuation is ok ?", compute="_compute_stock_valuation_ok"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should store it ?

Comment on lines 62 to 68
if (
not svl
and line.purchase_line_id
and line.price_unit != line.purchase_line_id.price_unit
):
stock_valuation_ok = False
line.stock_valuation_ok = stock_valuation_ok
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid add if when using a boolean

Suggested change
if (
not svl
and line.purchase_line_id
and line.price_unit != line.purchase_line_id.price_unit
):
stock_valuation_ok = False
line.stock_valuation_ok = stock_valuation_ok
line.stock_valuation_ok = (
not svl
and line.purchase_line_id
and line.price_unit != line.purchase_line_id.price_unit
)

"company_id": self.company_id.id,
"product_id": self.product_id.id,
"description": "%s - %s" % (self.move_id.name, self.product_id.name)
or self.product_id.name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the or self.product_id.name

class AccountMove(models.Model):
_inherit = "account.move"

svl_warn_msg = fields.Text(compute="_compute_svl_warn_msg")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be cleaner to have a boolean here stock_valuation_ok stored, and then in the view adding the text

]
)
self.assertTrue(svl)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add tests where the invoice uom qty is different ?

def test_update_stock_valuation_from_invoice_case_2(self):
purchase order with 12 unit
invoice with 1 Dozens

def test_update_stock_valuation_from_invoice_case_2(self):
purchase order with 1 Dozens
invoice with 1 Dozens

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienbeau , it's done.

if (
not svl
and line.purchase_line_id
and line.price_unit != line.purchase_line_id.price_unit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be carefull of the uom ! (see the comment in the test)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastienbeau , it's done.

@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch from 66c5247 to 934cb3e Compare December 8, 2023 19:10
@chafique-delli chafique-delli marked this pull request as draft December 8, 2023 19:13
@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch from 934cb3e to e0dbdaa Compare December 11, 2023 09:05
@chafique-delli chafique-delli marked this pull request as ready for review December 11, 2023 09:12
@chafique-delli chafique-delli force-pushed the 14.0-ADD-account_invoice_update_stock_valuation branch from 1f19869 to 49dfb88 Compare December 20, 2023 14:57
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants