Skip to content
Snippets Groups Projects
Commit 495116f8f3ad authored by szeka.wong's avatar szeka.wong
Browse files

WIP - Defines fiscal year model.

parent fc64285c83b6
No related branches found
No related tags found
No related merge requests found
......@@ -33,8 +33,8 @@
'author': 'XCG Consulting',
'website': 'http://odoo.consulting/',
'depends': [
'base',
'account',
],
'data': [
'security/ir.model.access.csv',
......@@ -37,7 +37,10 @@
],
'data': [
'security/ir.model.access.csv',
'views/account_period.xml',
'views/account_fiscalyear.xml',
],
'installable': True,
......
# flake8: noqa
from . import account_period
from . import account_fiscalyear
# encoding: utf-8
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2018 XCG Consulting (http://www.xcg-consulting.fr/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from odoo import _
from odoo import api
from odoo import exceptions
from odoo import fields
from odoo import models
class AccountFiscalyear(models.Model):
"""Account fiscal year defined an accounting year.
"""
_name = 'account.fiscalyear'
_description = 'Fiscal year'
name = fields.Char(
string='Fiscal year',
required=True,
)
code = fields.Char(
string='Code',
size=6,
)
period_ids = fields.One2many(
comodel_name='account.period',
inverse_name='fiscalyear_id',
string='Periods',
)
......@@ -36,4 +36,40 @@
_name = 'account.period'
_description = 'Account period'
_inherit = 'mail.thread'
name = fields.Char(
string='Period name',
required=True,
)
code = fields.Char(
string='Code',
size=12,
)
fiscalyear_id = fields.Many2one(
comodel_name='account.fiscalyear',
string='Fiscal year',
)
date_start = fields.Date(
string='Start of period',
required=True,
)
date_stop = fields.Date(
string='End of period',
required=True,
)
input_date_stop = fields.Date(
string='End of input',
required=True,
)
state = fields.Selection(
selection=[
('draft', 'Open'),
('done', 'Closed'),
],
string='State',
)
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_fiscalyear_search" model="ir.ui.view">
<field name="name">account_fiscalyear_search</field>
<field name="model">account.fiscalyear</field>
<field name="arch" type="xml">
<search>
<field name="name" />
<field name="code" />
</search>
</field>
</record>
<record id="account_fiscalyear_list" model="ir.ui.view">
<field name="name">account_fiscalyear_list</field>
<field name="model">account.fiscalyear</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="code" />
<field name="period_ids" />
</tree>
</field>
</record>
<record id="account_fiscalyear_form" model="ir.ui.view">
<field name="name">"account_fiscalyear_form"</field>
<field name="model">account.fiscalyear</field>
<field name="arch" type="xml">
<form>
<header>
</header>
<sheet>
<group>
<field name="name" />
<field name="code" />
<field name="period_ids" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Add a menu command to manage accounting fiscalyear. -->
<record id="account_fiscalyear_action" model="ir.actions.act_window">
<field name="name">Accounting fiscal years</field>
<field name="res_model">account.fiscalyear</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem id="account_fiscalyear_menu_command" parent="account.account_account_menu"
name="Accounting fiscal years" action="account_fiscalyear_action"/>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_period_search" model="ir.ui.view">
<field name="name">account_period_search</field>
<field name="model">account.period</field>
<field name="arch" type="xml">
<search>
<field name="code" />
</search>
</field>
</record>
<record id="account_period_list" model="ir.ui.view">
<field name="name">account_period_list</field>
<field name="model">account.period</field>
<field name="arch" type="xml">
<tree>
<field name="fiscalyear_id" />
<field name="name" />
<field name="code" />
<field name="date_start" />
<field name="date_stop" />
<field name="input_date_stop" />
<field name="state" />
</tree>
</field>
</record>
<record id="account_period_form" model="ir.ui.view">
<field name="name">"account_period_form"</field>
<field name="model">account.period</field>
<field name="arch" type="xml">
<form>
<header>
<field name="state" widget="statusbar" />
</header>
<sheet>
<group col="4">
<field name="name" />
<field name="date_start" />
<field name="fiscalyear_id" />
<field name="date_stop" />
<field name="code" />
<field name="input_date_stop" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Add a menu command to manage accounting period. -->
<record id="account_period_action" model="ir.actions.act_window">
<field name="name">Accounting periods</field>
<field name="res_model">account.period</field>
<field name="view_mode">tree,form</field>
<field name="view_type">form</field>
</record>
<menuitem id="account_period_menu_command" parent="account.account_account_menu"
name="Accounting periods" action="account_period_action"/>
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment