-
-
Notifications
You must be signed in to change notification settings - Fork 722
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][ADD] stock_valuation_specific_identification #2139
base: 16.0
Are you sure you want to change the base?
[16.0][ADD] stock_valuation_specific_identification #2139
Conversation
7fcb654
to
7349ed2
Compare
I think this module shares a similar objective with OCA/stock-logistics-workflow#1527. One major difference, I understand, is that this module creates an SVL record per serial and the other one (stock_valuation_fifo_lot) does not (multiple lots/serials can be linked to an SVL record). Do you see a conceptual issue with the approach of the other module? |
7349ed2
to
84b204c
Compare
Hi @yostashiro, Thanks for pointing out I like the approach taken in I believe |
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.
Partial code review.
_inherit = "stock.lot" | ||
|
||
specific_ident_cost = fields.Boolean( | ||
related="product_id.categ_id.property_specific_ident_cost", |
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.
related="product_id.categ_id.property_specific_ident_cost", | |
related="product_id.property_specific_ident_cost", |
class ProductProduct(models.Model): | ||
_inherit = "product.product" | ||
|
||
specific_ident_cost = fields.Boolean( |
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 failed to understand to add this field in product.product
model with readonly
instead of just using from product.template
"""Prepare the values for a stock valuation layer created by a delivery. | ||
This should only be called for specific identification valuation method. | ||
|
||
:param quantity: the quantity to value, expressed in `product_id..uom_id` |
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.
:param quantity: the quantity to value, expressed in `product_id..uom_id` | |
:param quantity: the quantity to value, expressed in `product_id.uom_id` |
quantity = -1 * quantity # negative for out valuation layers | ||
sid_vals = self._run_out_spec_ident(abs(quantity), company) |
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.
quantity = -1 * quantity # negative for out valuation layers | |
sid_vals = self._run_out_spec_ident(abs(quantity), company) | |
sid_vals = self._run_out_spec_ident(quantity, company) |
"product_id": self.product_id.id, | ||
"value": sid_vals.get("value"), | ||
"unit_cost": sid_vals.get("unit_cost"), | ||
"quantity": quantity, |
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.
"quantity": quantity, | |
"quantity": -1 * quantity, |
for ( | ||
candidate_line | ||
) in candidate.stock_move_id.move_line_ids.filtered( | ||
lambda x: x.lot_id == lot and x.remaining_qty > 0.0 | ||
): | ||
qty_taken_on_candidate = min( | ||
qty_to_take_on_candidates, candidate_line.remaining_qty | ||
) |
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 don't understand this part. candidate_line
is an instance of stock move line
, isn't? I don't think stock move line
record has remaining_qty
field. Am I missing something?
|
||
# Find back incoming stock valuation layers (called candidates here) to | ||
# value `quantity`. | ||
qty_to_take_on_candidates = quantity |
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.
Is this for the purpose of code readable?
84b204c
to
b1d111d
Compare
Currently translated at 100.0% (185 of 185 strings) Translation: stock-logistics-warehouse-16.0/stock-logistics-warehouse-16.0-stock_reserve Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_reserve/it/
We were lacking the default location id so we could select the tray. It was also needed to avoid compting a pos when no tray is selected.
912701c
to
3f70122
Compare
@matt454357 There are some changes and commits that are not related to the PR. It seems like something went wrong during your rebase. |
@matt454357 I decided to go with
I will create a new PR with some adjustments since the author of the existing PR has not followed up on it. Would you be interested in contributing your ideas (e.g., the revaluation process) after I create the PR? |
Hi @AungKoKoLin1997, It has been a long time since I last did a PR. I shouldn't have merged the upstream changes made after starting my PR. I thought it might fix a test that was failing in Anyway, I am happy to contribute to the Revaluation is accessed from the valuation tree view, after grouping by lot/serial. Therefore, we may want to change |
New module to add Specific Identification Inventory Valuation Method.
3f70122
to
bd806b3
Compare
@matt454357 Thank you for your interest. I have created draft state PR OCA/stock-logistics-workflow#1676 and I have to add test cases and consider fixing issue that is proposed OCA/stock-logistics-workflow#1350 (comment). Let me ping you when it is ready. |
New module to add Specific Identification Inventory Valuation Method.