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

[15.0][IMP][account_financial_report]: add custom intervals for aged partner report #1083

Merged

Conversation

ernesto-garcia-tecnativa
Copy link
Contributor

@Tecnativa TT45574

@carolinafernandez-tecnativa
Copy link
Contributor

WIP

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 5 times, most recently from 9a73417 to 7dfbf94 Compare November 22, 2023 17:06
@carolinafernandez-tecnativa
Copy link
Contributor

@pedrobaeza could you please check it now? Thanks

@pedrobaeza pedrobaeza added this to the 15.0 milestone Nov 29, 2023
@pedrobaeza pedrobaeza changed the title [IMP][account_financial_report]: add custom intervals for aged partner report [15.0][IMP][account_financial_report]: add custom intervals for aged partner report Nov 29, 2023
name = fields.Char(required=True)
code = fields.Char(required=True)
account_age_report_config_id = fields.Many2one("account.age.report.configuration")
lower_limit = fields.Integer()
Copy link
Member

@pedrobaeza pedrobaeza Nov 29, 2023

Choose a reason for hiding this comment

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

We talked here about putting only one value, so no need to check overlappings and missing gaps:

Configuration 1:

  • 15
  • 30
  • 60

It means the first interval is from 0 to 15, the second from 16 to 30, and the third is 61+.

Choose a reason for hiding this comment

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

Done

class ResCompany(models.Model):
_inherit = "res.company"

age_partner_config_id = fields.Many2one(
Copy link
Member

Choose a reason for hiding this comment

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

Don't store this in company.

Choose a reason for hiding this comment

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

Done


default_age_partner_config_id = fields.Many2one(
"account.age.report.configuration",
related="company_id.age_partner_config_id",
Copy link
Member

Choose a reason for hiding this comment

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

Don't mix related and default_*. A default is for all companies.

Choose a reason for hiding this comment

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

Done

@@ -14,3 +14,5 @@ currency used in account move lines is properly shown.

In case that in an account has not been configured a second currency foreign
currency balances are not available.

Invoicing / Settings / Invoicing / OCA Aged Report Configuration you will be able to set dynamic intervals that will appear on the Aged Partner Balance
Copy link
Member

Choose a reason for hiding this comment

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

This should go better redacted on CONFIGURE.rst. And please respect 80 cols limit.

Choose a reason for hiding this comment

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

Done

return {
0: {"header": _("Partner"), "field": "name", "width": 70},
1: {
"header": _("Residual"),
Copy link
Member

Choose a reason for hiding this comment

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

Residual and current columns should be respected, no matter the configuration.

Choose a reason for hiding this comment

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

Done

"field_final_balance": "older",
}
if not report.age_partner_config_id:
report_columns.update(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's better to use a hidden configuration (with active=False) with all these lines, and prevent its removal than hardcode all these lines. What do you think?

<div class="act_as_cell" style="width: 9.64%;">91 - 120 d.</div>
<!--## older-->
<div class="act_as_cell" style="width: 9.64%;">> 120 d.</div>
<t t-if="not age_partner_config">
Copy link
Member

Choose a reason for hiding this comment

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

Here, it shouldn't be needed the if, as it should be already got in the Python structure.

Choose a reason for hiding this comment

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

If it is not added, it will show all columns and it is not correct.

t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
/>
</div>
<t t-if="not age_partner_config">
Copy link
Member

Choose a reason for hiding this comment

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

The same here: you shouldn't put an if.

@@ -216,30 +232,38 @@
</div>
<!--## amount_residual-->
<div class="act_as_cell" style="width: 6.00%;">Residual</div>
<t t-if="not age_partner_config">
Copy link
Member

Choose a reason for hiding this comment

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

The same...

>
<t
t-out="line['current']"
<t t-if="not age_partner_config">
Copy link
Member

Choose a reason for hiding this comment

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

And the same...

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 2 times, most recently from 0c1f43c to fae7499 Compare December 1, 2023 16:00
@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch from fae7499 to 6827961 Compare February 20, 2024 20:08
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

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

Could you resolve conflicts @carolinafernandez-tecnativa ?

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 2 times, most recently from af155c6 to 1b815a0 Compare March 13, 2024 17:50
@carolinafernandez-tecnativa
Copy link
Contributor

Could you resolve conflicts @carolinafernandez-tecnativa ?

Done!

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 10 times, most recently from a583107 to 0d75c78 Compare March 15, 2024 12:28
@chienandalu
Copy link
Member

New conflicts :( When you can @carolinafernandez-tecnativa

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch from 0d75c78 to 36931c3 Compare March 22, 2024 10:34
@carolinafernandez-tecnativa
Copy link
Contributor

@carolinafernandez-tecnativa several things:

  • I can't delete configuration lines.
  • It puts "Superior limit", but it should "Inferior limit" AFAIK, as it's the starting days from which the interval is activated.
  • Why having "code" and "name"? I think the code (for internal purposes) should be automatic. It can be the ID for example.

Thanks!
Fixed first 2 points, WIP with third point.

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 3 times, most recently from a225669 to c23b261 Compare March 27, 2024 16:45
@pedrobaeza
Copy link
Member

Tested on runboat, the limits are not working well.

Check the example in http://oca-account-financial-reporting-15-0-pr1083-c23b2616a35d.runboat.odoo-community.org with "Test customer", that has an invoice with due date 2024-03-27, and when reporting for that date, the amount appears in both the "Current" column and in "5 days" one. And you have to overpass 10 days to see the amount in the column "10 days". I think that the computation is still based on superior limit, not on inferior one.

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 2 times, most recently from 0df362e to 060727c Compare April 2, 2024 12:02
@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch from 060727c to 736c524 Compare April 3, 2024 17:51
@pedrobaeza
Copy link
Member

It has still some edges:

  • For an interval with superior limit 1 and a invoice with due today, it appears in current debt + the 1 interval:

imagen

  • Totals are not taking into account:

imagen

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch 2 times, most recently from 6242c40 to 441927a Compare April 4, 2024 17:38
@carolinafernandez-tecnativa
Copy link
Contributor

It has still some edges:

  • For an interval with superior limit 1 and a invoice with due today, it appears in current debt + the 1 interval:

imagen

  • Totals are not taking into account:

imagen

Could you please check now?

I fw theses changes to v16

@carolinafernandez-tecnativa
Copy link
Contributor

It has still some edges:

  • For an interval with superior limit 1 and a invoice with due today, it appears in current debt + the 1 interval:

imagen

  • Totals are not taking into account:

imagen

Could you please check now?

I fw theses changes to v16

Hi @pilarvargas-tecnativa could you please help us to validate? thanks

Copy link
Contributor

@pilarvargas-tecnativa pilarvargas-tecnativa left a comment

Choose a reason for hiding this comment

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

I have run the test in runbot and the ranges in which the overdue invoices appear in the report are correct. Thanks 👍

@carolinafernandez-tecnativa carolinafernandez-tecnativa force-pushed the 15.0-account_financial_report-custom-intervals branch from 441927a to 7e08953 Compare April 8, 2024 17:11
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.

Finally!

/ocabot merge minor

@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). 🤖

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 15.0-ocabot-merge-pr-1083-by-pedrobaeza-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit a8365e7 into OCA:15.0 Apr 9, 2024
5 checks passed
@OCA-git-bot
Copy link
Contributor

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

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.

6 participants