Skip to content

Commit

Permalink
account_cutoff_start_end_dates: small code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-via authored and dzungtran89 committed Feb 16, 2023
1 parent f835c41 commit 363ab49
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
5 changes: 4 additions & 1 deletion account_cutoff_start_end_dates/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/account-closing",
"depends": ["account_cutoff_base", "account_invoice_start_end_dates"],
"data": ["views/account_cutoff.xml"],
"data": [
"views/account_cutoff.xml",
"views/account_cutoff_line.xml",
],
"images": [
"images/prepaid_revenue_draft.jpg",
"images/prepaid_revenue_journal_entry.jpg",
Expand Down
6 changes: 3 additions & 3 deletions account_cutoff_start_end_dates/models/account_cutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def _get_default_source_journals(self):
column2="journal_id",
string="Source Journals",
default=lambda self: self._get_default_source_journals(),
readonly=True,
states={"draft": [("readonly", False)]},
states={"done": [("readonly", True)]},
check_company=True,
domain="[('company_id', '=', company_id)]",
)
forecast = fields.Boolean(
readonly=True,
Expand Down Expand Up @@ -181,7 +181,7 @@ def get_lines(self):
mapping = self._get_mapping_dict()
domain = [
("journal_id", "in", self.source_journal_ids.ids),
("display_type", "not in", ("line_note", "line_section")),
("display_type", "=", "product"),
("company_id", "=", self.company_id.id),
("balance", "!=", 0),
]
Expand Down
36 changes: 3 additions & 33 deletions account_cutoff_start_end_dates/views/account_cutoff.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<!-- ACCOUNT CUTOFF -->
<record id="account_cutoff_tree" model="ir.ui.view">
<field name="name">account.cutoff.prepaid.tree</field>
<field name="name">account.cutoff.start.end.dates.tree</field>
<field name="model">account.cutoff</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_tree" />
<field name="arch" type="xml">
Expand Down Expand Up @@ -38,7 +37,7 @@
</field>
</record>
<record id="account_cutoff_form" model="ir.ui.view">
<field name="name">account.cutoff.prepaid.form</field>
<field name="name">account.cutoff.start.end.dates.form</field>
<field name="model">account.cutoff</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_form" />
<field name="arch" type="xml">
Expand Down Expand Up @@ -110,7 +109,7 @@
</field>
</record>
<record id="account_cutoff_filter" model="ir.ui.view">
<field name="name">prepaid.account.cutoff.prepaid.search</field>
<field name="name">account.cutoff.start.end.dates.search</field>
<field name="model">account.cutoff</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_filter" />
<field name="arch" type="xml">
Expand All @@ -131,33 +130,4 @@
</filter>
</field>
</record>
<!-- ACCOUNT CUTOFF LINES -->
<record id="account_cutoff_line_form" model="ir.ui.view">
<field name="name">account.cutoff.line.prepaid.form</field>
<field name="model">account.cutoff.line</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_line_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="start_date" />
<field name="end_date" />
</field>
<field name="cutoff_amount" position="before">
<field name="total_days" />
<field name="cutoff_days" />
</field>
</field>
</record>
<record id="account_cutoff_line_tree" model="ir.ui.view">
<field name="name">account.cutoff.line.prepaid.tree</field>
<field name="model">account.cutoff.line</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_line_tree" />
<field name="arch" type="xml">
<field name="analytic_distribution" position="after">
<field name="start_date" optional="show" />
<field name="end_date" optional="show" />
<field name="total_days" optional="show" />
<field name="cutoff_days" optional="show" />
</field>
</field>
</record>
</odoo>
36 changes: 36 additions & 0 deletions account_cutoff_start_end_dates/views/account_cutoff_line.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2013-2022 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="account_cutoff_line_form" model="ir.ui.view">
<field name="name">account.cutoff.line.prepaid.form</field>
<field name="model">account.cutoff.line</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_line_form" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="start_date" />
<field name="end_date" />
</field>
<field name="cutoff_amount" position="before">
<field name="total_days" />
<field name="cutoff_days" />
</field>
</field>
</record>
<record id="account_cutoff_line_tree" model="ir.ui.view">
<field name="name">account.cutoff.line.prepaid.tree</field>
<field name="model">account.cutoff.line</field>
<field name="inherit_id" ref="account_cutoff_base.account_cutoff_line_tree" />
<field name="arch" type="xml">
<field name="analytic_distribution" position="after">
<field name="start_date" optional="show" />
<field name="end_date" optional="show" />
<field name="total_days" optional="show" />
<field name="cutoff_days" optional="show" />
</field>
</field>
</record>
</odoo>

0 comments on commit 363ab49

Please sign in to comment.