Skip to content

[6756][ADD] sale_delivery_rank#255

Open
smorita7749 wants to merge 5 commits into
18.0from
6756-add-partner_delivery_rank
Open

[6756][ADD] sale_delivery_rank#255
smorita7749 wants to merge 5 commits into
18.0from
6756-add-partner_delivery_rank

Conversation

@smorita7749
Copy link
Copy Markdown

@smorita7749 smorita7749 commented May 25, 2026

QT6756

This module adds the delivery field in res.partner and the delivery field as related to sale.order and accont.move, ultimately allowing users to export this field thorough sale.order and accont.move.

Copy link
Copy Markdown

@nobuQuartile nobuQuartile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module name, sale_delivery_rank, is better.

Could you add ja.po?

Comment on lines +13 to +22
<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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not working, is it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed inherit_id.

Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

delivery_rank = fields.Selection(
related="partner_shipping_id.delivery_rank",
store=True,
readonly=True,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove it as readonly is True by default for related fields.

Suggested change
readonly=True,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


delivery_rank = fields.Selection(
related="partner_shipping_id.delivery_rank",
store=True,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to store this field in sale.order, so I removed it(SO is as well)

Comment thread partner_delivery_rank/__manifest__.py Outdated
"author": "Quartile",
"license": "LGPL-3",
"installable": True,
"depends": ["account", "sale"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"depends": ["account", "sale"],
"depends": ["sale"],

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines +10 to +12
delivery_rank = fields.Selection(
related="partner_shipping_id.delivery_rank",
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be shown only for delivery contact type?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@smorita7749 smorita7749 changed the title [6756][ADD] partner_delivery_rank [6756][ADD] sale_delivery_rank May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants