-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
base: 14.0
Are you sure you want to change the base?
[14.0][ADD] account_invoice_update_stock_valuation #1579
Conversation
9989efe
to
c28eca6
Compare
c28eca6
to
9d3165e
Compare
9d3165e
to
c991f81
Compare
_inherit = "account.move.line" | ||
|
||
stock_valuation_ok = fields.Boolean( | ||
string="Stock valuation is ok ?", compute="_compute_stock_valuation_ok" |
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.
maybe we should store it ?
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 |
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.
avoid add if when using a boolean
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, |
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.
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") |
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.
It will be cleaner to have a boolean here stock_valuation_ok
stored, and then in the view adding the text
] | ||
) | ||
self.assertTrue(svl) | ||
|
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.
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
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.
@sebastienbeau , it's done.
if ( | ||
not svl | ||
and line.purchase_line_id | ||
and line.price_unit != line.purchase_line_id.price_unit |
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.
be carefull of the uom ! (see the comment in the test)
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.
@sebastienbeau , it's done.
66c5247
to
934cb3e
Compare
934cb3e
to
e0dbdaa
Compare
1f19869
to
49dfb88
Compare
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. |
cc @sebastienbeau