Skip to content

Commit

Permalink
[18.0][MIG] account_credit_control: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Jan 10, 2025
1 parent 6dcdce0 commit f230221
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 55 deletions.
1 change: 1 addition & 0 deletions account_credit_control/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Contributors
- `360ERP <https://www.360erp.com>`__:

- Andrea Stirpe
- Kevin Khao

Maintainers
-----------
Expand Down
2 changes: 1 addition & 1 deletion account_credit_control/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Credit Control",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"author": "Camptocamp,"
"Odoo Community Association (OCA),"
"Okia,"
Expand Down
2 changes: 1 addition & 1 deletion account_credit_control/models/credit_control_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class CreditControlLine(models.Model):
store=True,
)
level = fields.Integer(
related="policy_level_id.level", group_operator="max", store=True
related="policy_level_id.level", aggregator="max", store=True
)
manually_overridden = fields.Boolean()
run_id = fields.Many2one(comodel_name="credit.control.run", string="Source")
Expand Down
1 change: 1 addition & 0 deletions account_credit_control/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
- Naglis Jonaitis (Versada UAB) \<<[email protected]>\>
- [360ERP](https://www.360erp.com):
- Andrea Stirpe
- Kevin Khao
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
>credit.control.analysis.tree (in account_credit_control_analysis)</field>
<field name="model">credit.control.analysis</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="partner_id" />
<field name="partner_ref" />
<field name="policy_id" />
<field name="policy_level_id" />
<field name="level" />
<field name="open_balance" widget="monetary" />
<field name="currency_id" invisible="1" />
</tree>
</list>
</field>
</record>
<record id="credit_control_analysis_pivot_view" model="ir.ui.view">
Expand All @@ -37,7 +37,7 @@
<record model="ir.actions.act_window" id="credit_control_analysis_act_window">
<field name="name">Credit Control Analysis</field>
<field name="res_model">credit.control.analysis</field>
<field name="view_mode">tree,pivot</field>
<field name="view_mode">list,pivot</field>
<field name="domain">[]</field>
<field name="context">{}</field>
</record>
Expand Down
1 change: 1 addition & 0 deletions account_credit_control/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Naglis Jonaitis (Versada UAB) &lt;<a class="reference external" href="mailto:naglis&#64;versada.eu">naglis&#64;versada.eu</a>&gt;</li>
<li><a class="reference external" href="https://www.360erp.com">360ERP</a>:<ul>
<li>Andrea Stirpe</li>
<li>Kevin Khao</li>
</ul>
</li>
</ul>
Expand Down
7 changes: 3 additions & 4 deletions account_credit_control/tests/test_account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

from odoo import fields
from odoo.exceptions import UserError
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
Expand All @@ -17,8 +16,8 @@
@tagged("post_install", "-at_install")
class TestAccountInvoice(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.env.user.groups_id |= cls.env.ref(
"account_credit_control.group_account_credit_control_manager"
Expand Down
19 changes: 9 additions & 10 deletions account_credit_control/tests/test_credit_control_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

from odoo import fields
from odoo.exceptions import AccessError, UserError
from odoo.tests import tagged
from odoo.tests.common import Form
from odoo.tests import Form, tagged

from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
Expand All @@ -19,8 +18,8 @@
@tagged("post_install", "-at_install")
class TestCreditControlRun(AccountTestInvoicingCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
cls.env.user.groups_id |= cls.env.ref(
"account_credit_control.group_account_credit_control_manager"
Expand Down Expand Up @@ -110,8 +109,8 @@ def test_generate_credit_lines(self):
self.assertEqual(control_run.state, "done")

report_regex = (
r'<p>Policy "<b>%s</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>" % self.policy.name
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>"
)
regex_result = re.match(report_regex, control_run.report)
self.assertIsNotNone(regex_result)
Expand Down Expand Up @@ -161,8 +160,8 @@ def test_wiz_print_lines(self):
self.assertEqual(control_run.state, "done")

report_regex = (
r'<p>Policy "<b>%s</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>" % self.policy.name
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>"
)
regex_result = re.match(report_regex, control_run.report)
self.assertIsNotNone(regex_result)
Expand Down Expand Up @@ -196,8 +195,8 @@ def test_wiz_credit_control_emailer(self):
self.assertEqual(control_run.state, "done")

report_regex = (
r'<p>Policy "<b>%s</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>" % self.policy.name
rf'<p>Policy "<b>{self.policy.name}</b>" has generated <b>'
r"\d+ Credit Control Lines.</b><br></p>"
)
regex_result = re.match(report_regex, control_run.report)
self.assertIsNotNone(regex_result)
Expand Down
4 changes: 2 additions & 2 deletions account_credit_control/views/account_move.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
</group>
<separator string="Issued Lines" colspan="4" />
<field name="credit_control_line_ids" colspan="4" nolabel="1">
<tree>
<list>
<field name="date" />
<field name="level" />
<field name="state" />
<field name="channel" />
<field name="balance_due" />
<field name="policy_level_id" />
<field name="policy_id" />
</tree>
</list>
</field>
</page>
</notebook>
Expand Down
12 changes: 6 additions & 6 deletions account_credit_control/views/credit_control_communication.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
</group>
</group>
<field name="credit_control_line_ids" nolabel="1">
<tree>
<list>
<field name="date" />
<field name="level" />
<field name="state" />
<field name="channel" />
<field name="balance_due" />
<field name="policy_level_id" />
<field name="policy_id" />
</tree>
</list>
</field>
</sheet>
<div class="oe_chatter">
Expand Down Expand Up @@ -115,24 +115,24 @@
</field>
</record>
<record id="credit_control_communication_tree_view" model="ir.ui.view">
<field name="name">credit.control.communication.tree</field>
<field name="name">credit.control.communication.list</field>
<field name="model">credit.control.communication</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="partner_id" />
<field name="user_id" />
<field name="company_id" groups="base.group_multi_company" />
<field name="policy_level_id" />
<field name="policy_id" />
<field name="report_date" />
</tree>
</list>
</field>
</record>
<record model="ir.actions.act_window" id="credit_control_communication_action">
<field name="name">Credit Control Communications</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">credit.control.communication</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<!-- <field name="view_id" ref="credit_control_communication_tree_view"/> -->
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Expand Down
8 changes: 4 additions & 4 deletions account_credit_control/views/credit_control_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@
</field>
</record>
<record id="credit_control_line_tree" model="ir.ui.view">
<field name="name">credit.control.line.tree</field>
<field name="name">credit.control.line.list</field>
<field name="model">credit.control.line</field>
<field name="arch" type="xml">
<tree
<list
editable="bottom"
decoration-danger="state in ('error', 'email_error')"
decoration-muted="state == 'ignored'"
Expand Down Expand Up @@ -248,7 +248,7 @@
icon="fa-clock-o"
/>
<field name="activity_summary" />
</tree>
</list>
</field>
</record>
<menuitem
Expand All @@ -264,7 +264,7 @@
<field name="res_model">credit.control.line</field>
<field name="domain" />
<field name="binding_view_types">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="credit_control_line_tree" />
<field name="context">{'search_default_filter_draft': 1,
'search_default_filter_to_be_sent': 1}
Expand Down
18 changes: 9 additions & 9 deletions account_credit_control/views/credit_control_policy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<notebook colspan="4">
<page string="Policy levels">
<field name="level_ids" nolabel="1" colspan="4">
<tree>
<list>
<field name="name" />
<field name="level" />
<field name="channel" />
<field name="delay_days" />
<field name="computation_mode" />
<field name="email_template_id" />
</tree>
</list>
<form string="Policy level">
<field name="name" />
<notebook>
Expand Down Expand Up @@ -75,13 +75,13 @@
</field>
</record>
<record id="credit_control_policy_tree" model="ir.ui.view">
<field name="name">credit.control.policy.tree</field>
<field name="name">credit.control.policy.list</field>
<field name="model">credit.control.policy</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="do_nothing" />
</tree>
</list>
</field>
</record>
<menuitem
Expand All @@ -96,7 +96,7 @@
<field name="res_model">credit.control.policy</field>
<field name="domain" />
<field name="binding_view_types">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="credit_control_policy_tree" />
</record>
<menuitem
Expand Down Expand Up @@ -131,17 +131,17 @@
</field>
</record>
<record id="credit_control_policy_level_tree" model="ir.ui.view">
<field name="name">credit.control.policy.level.tree</field>
<field name="name">credit.control.policy.level.list</field>
<field name="model">credit.control.policy.level</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="name" />
<field name="level" />
<field name="channel" />
<field name="delay_days" />
<field name="computation_mode" />
<field name="email_template_id" />
</tree>
</list>
</field>
</record>
</odoo>
8 changes: 4 additions & 4 deletions account_credit_control/views/credit_control_run.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="credit_control_run_tree" model="ir.ui.view">
<field name="name">credit.control.run.tree</field>
<field name="name">credit.control.run.list</field>
<field name="model">credit.control.run</field>
<field name="arch" type="xml">
<tree>
<list>
<field name="date" readonly="state != 'draft'" />
<field
name="company_id"
groups="base.group_multi_company"
readonly="state != 'draft'"
/>
<field name="state" />
</tree>
</list>
</field>
</record>
<record id="credit_control_run_form" model="ir.ui.view">
Expand Down Expand Up @@ -118,7 +118,7 @@
<field name="res_model">credit.control.run</field>
<field name="domain" />
<field name="binding_view_types">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">list,form</field>
<field name="view_id" ref="credit_control_run_tree" />
</record>
<menuitem
Expand Down
Loading

0 comments on commit f230221

Please sign in to comment.