[7003][ADD] stock_lot_top_parent: trace top-level parent on lots/serials - #29
[7003][ADD] stock_lot_top_parent: trace top-level parent on lots/serials#29nobuQuartile wants to merge 2 commits into
Conversation
|
Add ja.po Translation notes"Lot/Serial" is referenced from the existing Odoo translation (odoo/stock). The remaining terms are module-specific and translated independently:
|
2ceb403 to
eb9681b
Compare
|
Ready for review |
AungKoKoLin1997
left a comment
There was a problem hiding this comment.
Module name suggestion: stock_lot_parent.
|
御社の中で検討いただき問題無ければ、無視頂いて大丈夫です。 新規レコード(未保存フォーム)でのcompute動作 — [stock_lot.py:31-43] の _compute_top_parent_location_ids は、親未設定時に target_lot = lot として lot.id を search ドメインに渡します。新規作成フォームでは id が NewId(仮ID)のため、Odooのバージョン・パッチ状況によっては search がエラーになるか予期しない挙動になります。新規ロット作成フォームを開いた時にエラーが出ないか要確認です。防御的に以下のガードを推奨します: for lot in self: |
Add fields to stock.lot to trace where a unique serial is used, as part of moving the customer's spreadsheet-based management into Odoo: - Top lv Parent S/N: the parent assembly's serial (lot) this lot belongs to - Top lv Parent P/N: the parent's product (related field) - Physical Location: the parent serial's current internal location(s), computed on the fly from stock quants
eb9681b to
190d2a0
Compare
AungKoKoLin1997
left a comment
There was a problem hiding this comment.
Code Review: LGTM
| "internal location.", | ||
| ) | ||
|
|
||
| @api.depends("top_parent_lot_id") |
There was a problem hiding this comment.
Not a major issue, but worth addressing it before we get hiccups.
| @api.depends("top_parent_lot_id") | |
| @api.depends( | |
| "top_parent_lot_id", | |
| "top_parent_lot_id.quant_ids.quantity", | |
| "top_parent_lot_id.quant_ids.location_id", | |
| "quant_ids", | |
| "quant_ids.quantity", | |
| "quant_ids.location_id", | |
| ) |
| quants = quant_model.search( | ||
| [ | ||
| ("lot_id", "=", target_lot.id), | ||
| ("location_id.usage", "=", "internal"), | ||
| ("quantity", ">", 0), | ||
| ] | ||
| ) |
There was a problem hiding this comment.
| quants = quant_model.search( | |
| [ | |
| ("lot_id", "=", target_lot.id), | |
| ("location_id.usage", "=", "internal"), | |
| ("quantity", ">", 0), | |
| ] | |
| ) | |
| quants = target_lot.quant_ids.filtered( | |
| lambda q: q.location_id.usage == "internal" | |
| and float_compare( | |
| q.quantity, 0, precision_rounding=q.product_uom_id.rounding | |
| ) | |
| > 0 | |
| ) |
|
We decided not to follow up on this. |
QT7003
What
New module
stock_lot_top_parentadding top-level parent traceability fields to lots/serials (Inventory > Products > Lots/Serial Numbers):top_parent_lot_id): Many2one to the parent assembly's serial (lot) this lot belongs to.top_parent_product_id): the parent's product — a related field (no compute, per maintainability guidance).top_parent_location_ids): Many2many of the parent serial's current internal location(s), computed on the fly fromstock.quant(empty when not in any internal location).Why
Trace where a unique serial is used, as part of moving the customer's spreadsheet-based management into Odoo. Per task-7003.
Test
pre-commitclean.