[6756][ADD] sale_delivery_rank#255
Conversation
nobuQuartile
left a comment
There was a problem hiding this comment.
The module name, sale_delivery_rank, is better.
Could you add ja.po?
| <record id="view_order_tree" model="ir.ui.view"> | ||
| <field name="name">sale.order.list</field> | ||
| <field name="model">sale.order</field> | ||
| <field name="inherit_id" ref="sale.view_order_tree" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='partner_id']" position="after"> | ||
| <field name="delivery_rank" optional="hide" /> | ||
| </xpath> | ||
| </field> | ||
| </record> |
| delivery_rank = fields.Selection( | ||
| related="partner_shipping_id.delivery_rank", | ||
| store=True, | ||
| readonly=True, |
There was a problem hiding this comment.
We can remove it as readonly is True by default for related fields.
| readonly=True, |
|
|
||
| delivery_rank = fields.Selection( | ||
| related="partner_shipping_id.delivery_rank", | ||
| store=True, |
There was a problem hiding this comment.
A design question. We should generally avoid storing related/computed values that depend on master records, since changing the value in the master record ends up triggering updates to many transactions. Does this need to be stored?
There was a problem hiding this comment.
There is no reason to store this field in sale.order, so I removed it(SO is as well)
| "author": "Quartile", | ||
| "license": "LGPL-3", | ||
| "installable": True, | ||
| "depends": ["account", "sale"], |
There was a problem hiding this comment.
| "depends": ["account", "sale"], | |
| "depends": ["sale"], |
| delivery_rank = fields.Selection( | ||
| related="partner_shipping_id.delivery_rank", | ||
| ) |
There was a problem hiding this comment.
Shouldn't it be compute store field? Then, we can use that in search field.
With current design, it will always up to date with partner master data.
Is it intentional?
There was a problem hiding this comment.
The rank is intended to classify delivery partners, so I don't think the field should be stored on the transactional records, which means SOs don't need to have the delivery rank at the time of the order.
The use case is to export the delivery_rank via sale.order.line and send it to salespersons periodically.
Regarding searchability, searching SOs or invoices by rank is not a frequent use case (JOIN is sufficient).
| <field name="inherit_id" ref="base.view_partner_form" /> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='category_id']" position="after"> | ||
| <field name="delivery_rank" /> |
There was a problem hiding this comment.
Shouldn't it be shown only for delivery contact type?
There was a problem hiding this comment.
Since partners used as shipping destinations don't always have type='delivery', I decided not to restrict the visibility strictly.
Would it help to add a help text such as "Used when this contact is set as a shipping destination" to the delivery rank field?
QT6756
This module adds the delivery field in
res.partnerand the delivery field as related tosale.orderandaccont.move, ultimately allowing users to export this field thoroughsale.orderandaccont.move.