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

[17.0][mig] purchase_analytic #707

Open
wants to merge 46 commits into
base: 17.0
Choose a base branch
from

Conversation

aisopuro
Copy link
Contributor

Replaces (resurrects?) #626

Laetitia Gangloff and others added 30 commits October 24, 2024 17:27
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-12.0/account-analytic-12.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-purchase_analytic/
Some of the "tricks" done in this module are no longer needed
and can be easily implemented with newest framework features:

* No need for an auxiliar `project_id2` field. User can set
  an analytic account with no lines and it is respected.
* Simplify onchange. Now update analytic line on the go (no
  need to save) which is a better UX because avoid unexpected
  changes on save.

Also re-label the field `project_id` to "Analytic Account" to
align with the typical label in newer versions of Odoo.
Tha label "Contract / Analytic" was last used in v8 (
https://github.com/odoo/odoo/blob/8.0/addons/sale/sale.py#L217).
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-15.0/account-analytic-15.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-15-0/account-analytic-15-0-purchase_analytic/
Currently translated at 100.0% (3 of 3 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/hr/
Currently translated at 100.0% (3 of 3 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/es/
Currently translated at 100.0% (3 of 3 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/fr/
weblate and others added 15 commits October 24, 2024 17:27
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/fr/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/fr_FR/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/pt_BR/
Currently translated at 100.0% (4 of 4 strings)

Translation: account-analytic-16.0/account-analytic-16.0-purchase_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-16-0/account-analytic-16-0-purchase_analytic/es/
Co-authored-by: Alexis de Lattre <[email protected]>
@aisopuro
Copy link
Contributor Author

Trying to re-open this, since the original PR was closed due to inactivity. I only did some pre-commit fixes and squashed them into @Wodran14 's original pre-commit commit.

@aisopuro
Copy link
Contributor Author

The coverage appears to be failing due to there not being tests for "empty cases", e.g. computing the value correctly if there are no lines on an order.

Could the maintainers give an opinion, is it required to meet those code coverage goals on a migration PR?

@StefanRijnhart
Copy link
Member

/ocabot migration purchase_analytic

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Dec 16, 2024
@OCA-git-bot OCA-git-bot mentioned this pull request Dec 16, 2024
18 tasks
@CLaurelB
Copy link
Contributor

CLaurelB commented Jan 3, 2025

Hello,

Functional test: LGTM 👍

Regarding the coverage: IMHO, there could be a test to remove the analytic distribution on the PO and then assert that the analytic distributions of the lines, previously set, remain intact. Additionally, there could be a test to set the same analytic distribution on multiple lines and verify that the analytic distribution of the PO is correctly set.

Best regards.

@CLaurelB
Copy link
Contributor

CLaurelB commented Jan 6, 2025

Hello @aisopuro,

Maybe this could help: avoinsystems#2

Best regards.

Add cases for setting the analytic distribution on a purchase order
without lines and unsetting the analytic distribution on a purchase
order with lines.
@aisopuro
Copy link
Contributor Author

OK, thank you @CLaurelB for the coverage expansion, that commit is now included here. All checks are green so this seems ready to review by maintainers.

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" ?>

Choose a reason for hiding this comment

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

Why this? I'd avoid this, AFAIK it's preferred to provide the encoding explicitly.

@@ -0,0 +1,34 @@
# Translation of Odoo Server.

Choose a reason for hiding this comment

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

There are missing commits present in 16.0, mainly related to translations, e.g. de8e27f. I'd suggest retrieving the history again and then cherrypicking the migration commits.


def _inverse_analytic_distribution(self):
"""
When set analytic_distribution set analytic distribution on all order lines

Choose a reason for hiding this comment

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

"when setting

Same in the below docstring.

"name": self.product_id.name,
"product_id": self.product_id.id,
"product_qty": 1.0,
"product_uom": self.uom_id.id,

Choose a reason for hiding this comment

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

I'd suggest making these params configurable and provide default values, so it may be called without params but also being able to provide some of them.

def test_analytic_distribution(self):
def add_new_order_line(self):
return [
Command.create(

Choose a reason for hiding this comment

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

Why don't you pass the order as param instead?

analytic_plan = self.env["account.analytic.plan"].create(
{"name": "Plan Test", "company_id": False}
)
analytic_plan = self.env["account.analytic.plan"].create({"name": "Plan Test"})

Choose a reason for hiding this comment

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

Why this? Could you document it in commit description?

Contributors
------------

- Laetitia Gangloff <[email protected]>

Choose a reason for hiding this comment

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

Isn't fixing double spaces part of the changes performed by precommit?

I mean:

Suggested change
- Laetitia Gangloff <[email protected]>
- Laetitia Gangloff <[email protected]>

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.