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][IMP] quality_control_oca, quality_control_stock_oca #1278

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Jun 6, 2024

Before this commit, the QC inspection was only triggered when the picking was already done. So, users could check the QC inspection only after the done state.

With this commit, the QC inspection can be triggered with three options ("Before", "Plan Ahead", and "After"). This allows the QC inspection to be triggered both when the picking is in progress and when it is done, enabling users to check the quality at any stage.

This PR does following:

  • Add date_done field in qc.inspection
    • Update date_done when status is success or fail
    • Clear date_done when status is reset to draft
  • Update form and list views to show date, and date_done
  • Add date and date_done fields in the search filter
  • Add the timing field in the QC trigger line to enable
    • When timing is 'After', an inspection is generated when a picking with the trigger is done.
    • When timing is 'Before', an inspection is generated for each related
      move when a picking with the trigger is confirmed.
    • When timing is 'Plan Ahead', a 'Plan' inspection is generated for
      each related move when a picking with the trigger is confirmed. A
      plan inspection is just a plan, and cannot be updated except for the
      date. A plan inspection gets converted into an executable inspection
      once the picking is done.

@qrtl QT4613

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-quality_control_oca branch 2 times, most recently from e1f110e to e7ff281 Compare June 6, 2024 10:22
required=True,
readonly=True,
copy=False,
default=fields.Datetime.now,
states={"draft": [("readonly", False)]},
)
date_done = fields.Datetime(readonly=True)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Just to make the name presentation somewhat consistent among date fields.

Suggested change
date_done = fields.Datetime(readonly=True)
date_done = fields.Datetime(readonly=True, "Completion Date")
create_date = fields.Datetime("Create Date")

Comment on lines 143 to 145
<field name="create_date" optional="show" />
<field name="date" optional="show" />
<field name="date_done" optional="show" />
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I'd prefer to have these fields after product_id, to be slightly less invasive.

@@ -171,6 +176,9 @@
domain="[('success', '=', False)]"
/>
<newline />
<separator />
<filter name="plan_date" string="Plan Date" date="date" />
<filter name="date_done" string="Date Done" date="date_done" />
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Suggested change
<filter name="date_done" string="Date Done" date="date_done" />
<filter name="date_done" string="Completion Date" date="date_done" />

context="{'group_by': 'date'}"
/>
<filter
string="Date Done"
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Suggested change
string="Date Done"
string="Completion Date"

Comment on lines +126 to +133
def write(self, vals):
if "state" in vals:
if vals["state"] in ["success", "failed"]:
vals["date_done"] = datetime.now()
elif vals["state"] == "draft":
vals["date_done"] = False
return super().write(vals)

This comment was marked as outdated.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-quality_control_oca branch 4 times, most recently from b290d21 to 7eecf03 Compare June 7, 2024 09:08
Copy link
Sponsor 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.

Code review. LGTM.

Should we add a post init hook script to populate the new date_done field based on write_date or something?

@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as draft June 18, 2024 04:32
@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as ready for review June 18, 2024 14:31
@AungKoKoLin1997 AungKoKoLin1997 changed the title [16.0][IMP] quality_control_oca: add date_done field, update views, and add filters [16.0][IMP] quality_control_oca, quality_control_stock_oca Jun 18, 2024
Copy link
Sponsor 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.

I think we can squash commits into one at this point, combining descriptions as well.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Please don't include the .po file in the PR.

)

@mute_logger("odoo.models.unlink")
def test_inspection_create_for_template_with_before_timing(self):
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Let's remove the new test cases added here and onwards as they are redundant. Capturing triggers is already covered by existing tests.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Please make this section comprehensive and concise, instead of being so detailed on one of the configuration point.

Comment on lines 38 to 40
# To avoid CacheMiss error from tests of other modules
if "picking_type_id" not in self._cache:
return
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Not sure this is the right approach. Would be nice if someone could advise.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-quality_control_oca branch 2 times, most recently from d909498 to 62bbcbe Compare June 19, 2024 10:44
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-quality_control_oca branch 2 times, most recently from 9a5f302 to b5ad9ad Compare June 25, 2024 05:30
@@ -0,0 +1,12 @@
Configure a QC trigger in the product, product template, or product category to create inspections efficiently:
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Suggested change
Configure a QC trigger in the product, product template, or product category to create inspections efficiently:
Configure a QC trigger in the product, product template, or product category to define the conditions for creating inspections:

Comment on lines 11 to 12

This streamlined configuration ensures that QC inspections are created and managed effectively based on your specified triggers and conditions.
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Let's remove this part as I believe that the intention is obvious.

Suggested change
This streamlined configuration ensures that QC inspections are created and managed effectively based on your specified triggers and conditions.

Copy link
Sponsor 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.

Code review. 👍

Copy link

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

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

Functional review.

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

1 similar comment
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@AungKoKoLin1997
Copy link
Contributor Author

@OCA-manufacture-maintainer
Could you please review this improvement PR?

AungKoKoLin1997 and others added 2 commits September 2, 2024 11:33
This commit adds date_done field, update views and filters and the timing field in the QC trigger line to enable
following scenarios:

- When timing is 'Before', an inspection is generated for each related
  move when a picking with the trigger is confirmed.
- When timing is 'Plan Ahead', a 'Plan' inspection is generated for
  each related move when a picking with the trigger is confirmed. A
  plan inspection is just a plan, and cannot be updated except for the
  date. A plan inspection gets converted into an executable inspection
  once the picking is done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants