Skip to content

[6756][ADD] partner_shipping_rank - #255

Merged
yostashiro merged 6 commits into
18.0from
6756-add-partner_delivery_rank
Jun 18, 2026
Merged

[6756][ADD] partner_shipping_rank#255
yostashiro merged 6 commits into
18.0from
6756-add-partner_delivery_rank

Conversation

@smorita7749

@smorita7749 smorita7749 commented May 25, 2026

Copy link
Copy Markdown
Contributor

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.

@nobuQuartile nobuQuartile left a comment

Copy link
Copy Markdown

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
Contributor 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.

@yostashiro yostashiro left a comment

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.

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
Contributor 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
Contributor 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
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
Contributor 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).

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.

Comment thread sale_delivery_rank/views/res_partner_views.xml Outdated
@smorita7749 smorita7749 changed the title [6756][ADD] partner_delivery_rank [6756][ADD] sale_delivery_rank May 26, 2026

@yostashiro yostashiro left a comment

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.

Module name suggestion: partner_shipping_rank

'Delivery' could mean something else in Odoo.


delivery_rank = fields.Selection(
[("a", "A"), ("b", "B"), ("c", "C")],
help="Rank assigned to a delivery destination. ",

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
help="Rank assigned to a delivery destination. ",
help="Rank assigned to a delivery destination.",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Comment thread sale_delivery_rank/__manifest__.py Outdated
Comment on lines +5 to +6
"summary": "Assign a rank to partners as delivery destinations and "
"propagate it to sales orders and invoices for aggregation by rank.",

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.

"Propagate" may be misleading now that it's not kept in transactions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@yostashiro yostashiro changed the title [6756][ADD] sale_delivery_rank [6756][ADD] partner_shipping_rank May 28, 2026

@yostashiro yostashiro left a comment

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.

LGTM. 👍

@AungKoKoLin1997 AungKoKoLin1997 left a comment

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.

Code Review: LGTM

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.

Don't we need to add in the list view like sale order?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added the list view.

@smorita7749
smorita7749 force-pushed the 6756-add-partner_delivery_rank branch from 6b5c58a to 0f29ca0 Compare May 28, 2026 02:00
@yostashiro
yostashiro merged commit 8820c1d into 18.0 Jun 18, 2026
2 checks passed
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