Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] migrate purchase_cancel_reason #1776

Merged
merged 14 commits into from
Jul 22, 2024

Conversation

pierre-halleux
Copy link
Contributor

No description provided.

sylvainvh and others added 10 commits February 23, 2023 10:22
…_cancel_reason (OCA/sale-workflow) developed by CampToCamp. (OCA#438)

* [ADD] Add the module purchase_cancel_reason. Copy/past from the module sale_cancel_reason (OCA/sale-workflow) developed by CampToCamp.
Currently translated at 40.9% (9 of 22 strings)

Translation: purchase-workflow-14.0/purchase-workflow-14.0-purchase_cancel_reason
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_cancel_reason/pt_BR/
Currently translated at 36.3% (8 of 22 strings)

Translation: purchase-workflow-14.0/purchase-workflow-14.0-purchase_cancel_reason
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_cancel_reason/it/
Currently translated at 36.3% (8 of 22 strings)

Translation: purchase-workflow-14.0/purchase-workflow-14.0-purchase_cancel_reason
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_cancel_reason/it/
Copy link
Sponsor Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

@pierre-halleux Some little details...


cancel_reason_id = fields.Many2one(
comodel_name="purchase.order.cancel.reason",
string="Reason for cancellation",
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Suggested change
string="Reason for cancellation",
string="Cancellation reason",

Copy link

@jbaudoux jbaudoux Mar 30, 2023

Choose a reason for hiding this comment

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

Cancelation with one L then as we use US english

Comment on lines 22 to 27
<label for="cancel_reason_id" string="Cancellation reason:" />
<field
name="cancel_reason_id"
class="oe_inline"
options='{"no_open": True}'
/>
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

I propose to improve the view as follow:

Suggested change
<label for="cancel_reason_id" string="Cancellation reason:" />
<field
name="cancel_reason_id"
class="oe_inline"
options='{"no_open": True}'
/>
<label for="cancel_reason_id"/>
<pan> </pan>
<field name="cancel_reason_id" class="oe_inline" options="{&quot;no_open&quot;: True}"/>

Before:
image

After:
image

After

@pierre-halleux pierre-halleux force-pushed the 16.0-mig-purchase-workflow-pha branch 2 times, most recently from 930ff43 to 4d9c8cf Compare February 24, 2023 09:28
Copy link
Sponsor Contributor

@lmignon lmignon left a comment

Choose a reason for hiding this comment

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

LGTM (Code review + functional test)

Copy link
Contributor

@sbejaoui sbejaoui left a comment

Choose a reason for hiding this comment

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

Small fixes needed,

)


class PurchaseOrderCancelReason(models.Model):
Copy link
Contributor

Choose a reason for hiding this comment

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

please make dedicate file per model

</field>
</record>

<record id="view_purchase_order_cancel_reason_form" model="ir.ui.view">
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

from odoo.exceptions import UserError


class PurchaseOrderCancel(models.TransientModel):
Copy link
Contributor

Choose a reason for hiding this comment

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

the file name don't match the model name

if purchase_ids is None:
return act_close
if len(purchase_ids) > 1:
raise UserError(_("Only 1 purchase ID expected"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
raise UserError(_("Only 1 purchase ID expected"))
raise UserError(_("Only 1 purchase expected"))

Choose a reason for hiding this comment

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

I would even drop this restriction

self.ensure_one()
act_close = {"type": "ir.actions.act_window_close"}
purchase_ids = self._context.get("active_ids")
if purchase_ids is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if purchase_ids is None:
if purchase_ids is None or self._context.get("active_model") != "purchase.order":

<odoo>
<record id="view_purchase_order_cancel" model="ir.ui.view">
<field name="name">Reason for the cancellation</field>
<field name="model">purchase.order.cancel</field>
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, the file name don't match model name

Comment on lines +1 to +7
* Guewen Baconnier, Camptocamp SA
* Sylvain Van Hoof <sylvain@okia.be>

* `Ecosoft <http://ecosoft.co.th>`_:

* Kitti U. <kittiu@ecosoft.co.th>
* Tharathip C. <tharathipc@ecosoft.co.th>

Choose a reason for hiding this comment

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

reformat list: remove blank lines and remove indent

Copy link
Sponsor Contributor

@rousseldenis rousseldenis Apr 12, 2023

Choose a reason for hiding this comment

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

@jbaudoux This should remains as is as they are regrouped into the same company.

Looks like:

image

Choose a reason for hiding this comment

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

ah ok :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted this commit so it looks like it used to

@rousseldenis
Copy link
Sponsor Contributor

@pierre-halleux Could you attend comments ?

@pierre-halleux pierre-halleux force-pushed the 16.0-mig-purchase-workflow-pha branch 3 times, most recently from b42161c to 8068627 Compare April 12, 2023 07:08
Copy link
Sponsor Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

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

Code review.

Nitpicking: Missing a space between field label and value:

image

@rousseldenis
Copy link
Sponsor Contributor

@sbejaoui @jbaudoux Could you update your review ?

Copy link
Member

@FrancoMaxime FrancoMaxime left a comment

Choose a reason for hiding this comment

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

Same minor comment as @rousseldenis and @lmignon:
The purchase view can be improved

Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 21, 2024
@lmignon
Copy link
Sponsor Contributor

lmignon commented Jul 22, 2024

@HviorForgeFlow CAn you merge this one since you merged the one for v17 based on this.

@HviorForgeFlow
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-1776-by-HviorForgeFlow-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7d13f35 into OCA:16.0 Jul 22, 2024
6 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at ddafa41. Thanks a lot for contributing to OCA. ❤️

@lmignon lmignon deleted the 16.0-mig-purchase-workflow-pha branch July 23, 2024 07:10
@lmignon
Copy link
Sponsor Contributor

lmignon commented Jul 23, 2024

/ocabot merge nobump

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged 🎉 stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.