[6817][ADD] product_rental_fee_link - #6
Open
yostashiro wants to merge 1 commit into
Open
Conversation
Rental fees are managed as products separate from the equipment itself (one rental fee product per equipment model), and nothing in the standard data model ties the two together. Add a dedicated Rental Fee Product many2one on the product, restricted to services. A dedicated field is used rather than optional_product_ids: the latter is a many2many for cross-sell suggestions in the quotation configurator, so it cannot express a single verifiable relationship, carries no type restriction, and its meaning collides with genuine cross-sell entries. is_storable is deliberately not part of the domain nor the constraint: it only means "track inventory", can be turned on for a service by a user default, and core clears it for non-goods on recompute - so the product type is the only reliable discriminator.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
QT6817
背景
レンタル費用は機器そのものとは別の品目として管理する方針(OCJ-063・#6934/#6817)ですが、標準のデータモデルには両者を結びつける項目がありません。機種プロダクトに「レンタル費用品目」の many2one を追加します。
IF-01(機種)の商品CDは、この項目でたどったレンタル費用品目のバリアント(単価区分別)の
default_codeから導出する想定です。optional_product_idsを使わなかった理由06ocj2 では既に
optional_product_idsで機器→レンタル費用を紐づけた例が1件ありましたが、正本の関係としては採用しませんでした。sale/controllers/product_configurator.py)。ナビフロー→Odoo API で記帳する本プロジェクトの課金フローでは起動しないため、実質「何も強制しないデータ規約」になるis_storableを条件に含めていない理由当初案は
domain=[("type", "=", "service"), ("is_storable", "=", False)]でしたが、is_storableは外しました。ir_defaultでproduct.template.is_storable = true(全社)が設定されており、type="service"で作成したプロダクトもis_storable=Trueになる。この条件では候補が常に空になり、制約が正当なサービス品目を弾く(実測でテスト3件がエラー)compute_is_storableはtype != 'consu'のときis_storableを False に戻すだけで、サービス品目のis_storableは意味を持たないしたがって判別子は
typeのみとし、その理由をコードのコメントにも残しています。内容
product.template.rental_fee_product_tmpl_id(domain: サービス品目のみ)i18n/ja.po(レンタル費用品目 ほか)複数の機種が同一のレンタル費用品目を参照することは制限していません(同じ費用が複数機種に適用される運用があるため)。
確認済み
pre-commit run全フック Pass