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][IMP] product_contract: Set description under product name instead of description #1187

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

CarlosRoca13
Copy link
Contributor

Using the feature extraLines of Many2one field Component we can add the info under the product and avoid noice on the product description.

You can show this info on the description by using the system parameters:
- product_contract.show_recurrency
- product_contract.show_invoicing_type
- product_contract.show_date

cc @Tecnativa TT54693

ping @pedrobaeza @carlos-lopez-tecnativa @sergio-teruel

@OCA-git-bot
Copy link
Contributor

Hi @sbejaoui,
some modules you are maintaining are being modified, check this out!

@pedrobaeza pedrobaeza added this to the 17.0 milestone Jan 24, 2025
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

imagen

@@ -0,0 +1,5 @@
You can show the details showed under the product on description by using the next system parameters.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
You can show the details showed under the product on description by using the next system parameters.
You can include the contract details on the sales order description by
using the following system parameters:

)
field_selection = dict(field_info.get("selection"))
recurring_rule_label = field_selection.get(line.recurring_rule_type)
def get_product_contract_date_text(self):
Copy link
Member

Choose a reason for hiding this comment

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

Put these methods private.

@CarlosRoca13 CarlosRoca13 force-pushed the 17.0-IMP-product_contract branch from 422c85a to ed9cc64 Compare January 27, 2025 07:16
@CarlosRoca13
Copy link
Contributor Author

@pedrobaeza changes done!

… description

Using the feature extraLines of Many2one field Component we can add the info under the product and avoid noice on the product description.

You can show this info on the description by using the system parameters:
    - product_contract.show_recurrency
    - product_contract.show_invoicing_type
    - product_contract.show_date
@CarlosRoca13 CarlosRoca13 force-pushed the 17.0-IMP-product_contract branch from ed9cc64 to f006353 Compare January 27, 2025 07:31
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-1187-by-pedrobaeza-bump-minor, awaiting test results.

@OCA-git-bot
Copy link
Contributor

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

@OCA-git-bot OCA-git-bot merged commit 4935ecf into OCA:17.0 Jan 27, 2025
5 of 7 checks passed
@pedrobaeza pedrobaeza deleted the 17.0-IMP-product_contract branch January 27, 2025 17:44
Copy link
Contributor

@carlos-lopez-tecnativa carlos-lopez-tecnativa left a comment

Choose a reason for hiding this comment

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

@CarlosRoca13 sorry for the delay in revision. I found an error. It could be that the issue was present before this change, but I think it’s good to fix it. Let me know what you think.

Comment on lines +334 to +339
._fields["force_month_%s" % self.recurring_rule_type]
.get_description(self.env)
)
field_selection = dict(field_info.get("selection"))
invoicing_type_label = field_selection.get(
line.recurring_invoicing_type
)
line.name = _(
"""{product}:
- Recurrency: {recurring_rule}
- Invoicing Type: {invoicing_type}
- Date: {date_text}
"""
).format(
product=line.product_id.display_name,
recurring_rule=recurring_rule_label,
invoicing_type=invoicing_type_label,
date_text=date_text,
force_month_label = field_selection.get(
self.product_id["force_month_%s" % self.recurring_rule_type]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is necessary to take into account whether the field is set or not before accessing it, or make it a required field in the product form view to prevent mistakes.
I set the field as empty intentionally, but the user can do the same. What do you think?
image

image

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 think this could be attended in this other PR: #1188

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.

5 participants