From 1ca3b3df3421961caec3b747a364071c80f5c7da Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 17:14:58 +0700 Subject: initial commit --- account_fiscal_year_period/__init__.py | 3 + account_fiscal_year_period/__manifest__.py | 38 ++++ .../data/account_fiscal_sequence.xml | 11 + account_fiscal_year_period/i18n/ar_SY.po | 240 +++++++++++++++++++++ account_fiscal_year_period/models/__init__.py | 3 + .../models/account_fiscal_year.py | 50 +++++ account_fiscal_year_period/models/models.py | 176 +++++++++++++++ account_fiscal_year_period/security/groups.xml | 27 +++ .../security/ir.model.access.csv | 10 + .../description/check_to_open_or_close_period.png | Bin 0 -> 134850 bytes .../static/description/close_check.png | Bin 0 -> 82391 bytes .../static/description/define_fiscal_period.png | Bin 0 -> 94746 bytes .../static/description/define_fiscal_year.png | Bin 0 -> 60699 bytes .../description/generate_period_by_month.png | Bin 0 -> 133355 bytes .../static/description/group.png | Bin 0 -> 162333 bytes .../static/description/icon.png | Bin 0 -> 4533 bytes .../static/description/index.html | 134 ++++++++++++ .../static/description/inv.png | Bin 0 -> 114814 bytes .../static/description/menu.png | Bin 0 -> 175801 bytes account_fiscal_year_period/views/fiscal_year.xml | 56 +++++ account_fiscal_year_period/views/views.xml | 129 +++++++++++ 21 files changed, 877 insertions(+) create mode 100644 account_fiscal_year_period/__init__.py create mode 100644 account_fiscal_year_period/__manifest__.py create mode 100644 account_fiscal_year_period/data/account_fiscal_sequence.xml create mode 100644 account_fiscal_year_period/i18n/ar_SY.po create mode 100644 account_fiscal_year_period/models/__init__.py create mode 100644 account_fiscal_year_period/models/account_fiscal_year.py create mode 100644 account_fiscal_year_period/models/models.py create mode 100644 account_fiscal_year_period/security/groups.xml create mode 100644 account_fiscal_year_period/security/ir.model.access.csv create mode 100644 account_fiscal_year_period/static/description/check_to_open_or_close_period.png create mode 100644 account_fiscal_year_period/static/description/close_check.png create mode 100644 account_fiscal_year_period/static/description/define_fiscal_period.png create mode 100644 account_fiscal_year_period/static/description/define_fiscal_year.png create mode 100644 account_fiscal_year_period/static/description/generate_period_by_month.png create mode 100644 account_fiscal_year_period/static/description/group.png create mode 100644 account_fiscal_year_period/static/description/icon.png create mode 100644 account_fiscal_year_period/static/description/index.html create mode 100644 account_fiscal_year_period/static/description/inv.png create mode 100644 account_fiscal_year_period/static/description/menu.png create mode 100644 account_fiscal_year_period/views/fiscal_year.xml create mode 100644 account_fiscal_year_period/views/views.xml (limited to 'account_fiscal_year_period') diff --git a/account_fiscal_year_period/__init__.py b/account_fiscal_year_period/__init__.py new file mode 100644 index 0000000..5305644 --- /dev/null +++ b/account_fiscal_year_period/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models \ No newline at end of file diff --git a/account_fiscal_year_period/__manifest__.py b/account_fiscal_year_period/__manifest__.py new file mode 100644 index 0000000..30a4274 --- /dev/null +++ b/account_fiscal_year_period/__manifest__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +{ + 'name': "Account Fiscal Year Period Comunity", + + 'summary': """ + Create periods Of Fiscal Year Per Month ,With Ability To Open/Close Each Month + """, + + 'description': + """ + Create periods Of Fiscal Year Per Month With Ability To Open/Close Each Month + """ + , + + 'author': "Zain-Alabdin", + 'website': "https://www.linkedin.com/in/zainalabdeen-merghani-56b7ab106", + + 'category': 'Invoicing Management', + 'version': '0.3', + + # any module necessary for this one to work correctly + 'depends': ['account'], + + # always loaded + 'data': [ + 'security/groups.xml', + 'security/ir.model.access.csv', + 'views/fiscal_year.xml', + 'views/views.xml', + 'data/account_fiscal_sequence.xml' + ], + # only loaded in demonstration mode + 'demo': [], + "images": ['static/description/icon.png'], + 'installable': True, + 'application': True, + 'license': "AGPL-3", +} diff --git a/account_fiscal_year_period/data/account_fiscal_sequence.xml b/account_fiscal_year_period/data/account_fiscal_sequence.xml new file mode 100644 index 0000000..3432d6f --- /dev/null +++ b/account_fiscal_year_period/data/account_fiscal_sequence.xml @@ -0,0 +1,11 @@ + + + + + account.fiscal.period.sequence + account.fiscal.period.year + Fiscal/ + 4 + + + \ No newline at end of file diff --git a/account_fiscal_year_period/i18n/ar_SY.po b/account_fiscal_year_period/i18n/ar_SY.po new file mode 100644 index 0000000..ac09e5e --- /dev/null +++ b/account_fiscal_year_period/i18n/ar_SY.po @@ -0,0 +1,240 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_fiscal_year_period +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-12-16 10:09+0000\n" +"PO-Revision-Date: 2019-12-16 10:09+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_fiscal_year_period +#: model:ir.model,name:account_fiscal_year_period.model_account_move +msgid "Account Entry" +msgstr "القيد" + +#. module: account_fiscal_year_period +#: model:ir.model,name:account_fiscal_year_period.model_account_period +msgid "Account period" +msgstr "الفترات المحاسبية" + +#. module: account_fiscal_year_period +#: model:ir.actions.act_window,help:account_fiscal_year_period.action_account_fiscalyear +msgid "Click to start a new fiscal year." +msgstr "إضغط لإضافة فترة جديدة" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Close" +msgstr "إغلاق" + +#. module: account_fiscal_year_period +#: selection:account.fiscalyear.periods,state:0 +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Closed" +msgstr "مغلقة" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_code +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_code +msgid "Code" +msgstr "الرقم" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_comments +msgid "Comments" +msgstr "ملاحظات" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_company_id +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_company_id +msgid "Company" +msgstr "الشركة" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Create Periods" +msgstr "إنشاء الفترات" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_create_uid +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_create_uid +msgid "Created by" +msgstr "أنشئ بواسطة" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_create_date +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_create_date +msgid "Created on" +msgstr "أنشئ في" + +#. module: account_fiscal_year_period +#: model:ir.actions.act_window,help:account_fiscal_year_period.action_account_fiscalyear +msgid "Define your company's financial year according to your needs. A\n" +" financial year is a period at the end of which a company's\n" +" accounts are made up (usually 12 months). The financial year is\n" +" usually referred to by the date in which it ends. For example,\n" +" if a company's financial year ends November 30, 2011, then\n" +" everything between December 1, 2010 and November 30, 2011\n" +" would be referred to as FY 2011." +msgstr "Define your company's financial year according to your needs. A\n" +" financial year is a period at the end of which a company's\n" +" accounts are made up (usually 12 months). The financial year is\n" +" usually referred to by the date in which it ends. For example,\n" +" if a company's financial year ends November 30, 2011, then\n" +" everything between December 1, 2010 and November 30, 2011\n" +" would be referred to as FY 2011." + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_display_name +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_display_name +msgid "Display Name" +msgstr "الاسم المعروض" + +#. module: account_fiscal_year_period +#: selection:account.fiscalyear.periods,state:0 +msgid "Draft" +msgstr "مبدئي" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_date_stop +msgid "End Date" +msgstr "تاريخ الإنتهاء" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_date_stop +msgid "End of Period" +msgstr "تاريخ النهاية" + +#. module: account_fiscal_year_period +#: model:ir.model,name:account_fiscal_year_period.model_account_fiscalyear +#: model:ir.model,name:account_fiscal_year_period.model_account_fiscalyear_periods +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_name +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_fiscalyear_id +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Fiscal Year" +msgstr "الفترات المالية" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_name +msgid "Name" +msgstr "الإسم" + +#. module: account_fiscal_year_period +#: model:ir.actions.act_window,name:account_fiscal_year_period.action_account_fiscalyear +#: model:ir.ui.menu,name:account_fiscal_year_period.menu_action_account_fiscalyear +msgid "Fiscal Years" +msgstr "السنوات المالية" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Fiscal year" +msgstr "السنة المالية" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_tree +msgid "Fiscalyear" +msgstr "السنوات المالية" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Group By..." +msgstr "تجميع حسب.." + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_id +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_id +msgid "ID" +msgstr "المعرف" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods___last_update +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period___last_update +msgid "Last Modified on" +msgstr "آخر تعديل في" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_write_uid +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_write_uid +msgid "Last Updated by" +msgstr "آخر تحديث بواسطة" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_write_date +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_write_date +msgid "Last Updated on" +msgstr "آخر تحديث في" + +#. module: account_fiscal_year_period +#: selection:account.fiscalyear.periods,state:0 +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Open" +msgstr "فتح" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_special +msgid "Opening/Closing Period" +msgstr "إغلاق/فتح الفترة" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Period" +msgstr "فترة" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_sequence +msgid "Period Sequence" +msgstr "تسلسل" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_period_ids +#: model:ir.ui.menu,name:account_fiscal_year_period.account_fiscal_year +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Periods" +msgstr "الفترات" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Search Fiscalyear" +msgstr "البحث في السنوات المالية" + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "Set To Draft" +msgstr "إرجاع الى مبدئي" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_date_start +msgid "Start Date" +msgstr "تاريخ البدء" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_date_start +msgid "Start of Period" +msgstr "تاريخ البداية" + +#. module: account_fiscal_year_period +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_fiscalyear_periods_state +#: model:ir.model.fields,field_description:account_fiscal_year_period.field_account_period_state +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_search +msgid "Status" +msgstr "الحالة " + +#. module: account_fiscal_year_period +#: model:ir.model.fields,help:account_fiscal_year_period.field_account_period_special +msgid "These periods can overlap." +msgstr "These periods can overlap." + +#. module: account_fiscal_year_period +#: model:ir.ui.view,arch_db:account_fiscal_year_period.view_account_fiscalyear_periods_form +msgid "are you sure closed year and periods?" +msgstr "هلا أنت متأكد بأنك تريد إغلاق الفترة" + diff --git a/account_fiscal_year_period/models/__init__.py b/account_fiscal_year_period/models/__init__.py new file mode 100644 index 0000000..fac55f1 --- /dev/null +++ b/account_fiscal_year_period/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import account_fiscal_year +from . import models \ No newline at end of file diff --git a/account_fiscal_year_period/models/account_fiscal_year.py b/account_fiscal_year_period/models/account_fiscal_year.py new file mode 100644 index 0000000..dd0e5ec --- /dev/null +++ b/account_fiscal_year_period/models/account_fiscal_year.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +from odoo.exceptions import ValidationError +from odoo import api, fields, models, _ + + +class AccountFiscalYear(models.Model): + _name = 'account.fiscal.year' + _description = 'Fiscal Year' + + name = fields.Char(string='Name', required=True) + date_from = fields.Date(string='Start Date', required=True, + help='Start Date, included in the fiscal year.') + date_to = fields.Date(string='End Date', required=True, + help='Ending Date, included in the fiscal year.') + company_id = fields.Many2one('res.company', string='Company', required=True, + default=lambda self: self.env.company) + + @api.constrains('date_from', 'date_to', 'company_id') + def _check_dates(self): + ''' + Check interleaving between fiscal years. + There are 3 cases to consider: + + s1 s2 e1 e2 + ( [----)----] + + s2 s1 e2 e1 + [----(----] ) + + s1 s2 e2 e1 + ( [----] ) + ''' + for fy in self: + # Starting date must be prior to the ending date + date_from = fy.date_from + date_to = fy.date_to + if date_to < date_from: + raise ValidationError(_('The ending date must not be prior to the starting date.')) + domain = [ + ('id', '!=', fy.id), + ('company_id', '=', fy.company_id.id), + '|', '|', + '&', ('date_from', '<=', fy.date_from), ('date_to', '>=', fy.date_from), + '&', ('date_from', '<=', fy.date_to), ('date_to', '>=', fy.date_to), + '&', ('date_from', '<=', fy.date_from), ('date_to', '>=', fy.date_to), + ] + if self.search_count(domain) > 0: + raise ValidationError(_('You can not have an overlap between two fiscal years, ' + 'please correct the start and/or end dates of your fiscal years.')) diff --git a/account_fiscal_year_period/models/models.py b/account_fiscal_year_period/models/models.py new file mode 100644 index 0000000..cf59f45 --- /dev/null +++ b/account_fiscal_year_period/models/models.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api,_ +from dateutil.relativedelta import relativedelta +from odoo.exceptions import UserError, ValidationError + +class AccountFiscalyear(models.Model): + _name = "account.fiscalyear.periods" + _inherit = ['mail.thread'] + _description = "Fiscal Year" + _rec_name = 'fiscal_year_id' + + fiscal_year_id = fields.Many2one('account.fiscal.year',required=True, tracking=True) + code = fields.Char('Code',required=True, tracking=True,default='/',readonly=True) + company_id = fields.Many2one('res.company',related='fiscal_year_id.company_id',store=True,tracking=True) + date_start = fields.Date('Start Date',related='fiscal_year_id.date_from',store=True, tracking=True) + date_stop = fields.Date('Ending Date',related='fiscal_year_id.date_to',store=True, tracking=True) + period_ids = fields.One2many('account.month.period', 'fiscalyear_id', 'Periods', tracking=True) + state = fields.Selection( + [('draft', 'Draft'), + ('open', 'Open'),('done', 'Closed')], + 'Status', readonly=True, default='draft', tracking=True) + comments = fields.Text('Comments') + + @api.onchange('fiscal_year_id') + def _onchange_fiscal_year_id(self): + if self.fiscal_year_id: + self.code = 'FY/'+str(self.fiscal_year_id.name) + + + @api.model + def create(self, vals): + return super(AccountFiscalyear, self).create(vals) + + def open(self): + for rec in self: + rec.write({'state':'open'}) + + + def set_to_draft(self): + for rec in self: + rec.write({'state':'draft'}) + def done(self): + for rec in self: + rec.period_ids.write({'special':False}) + rec.write({'state':'done'}) + + #def get_month(self, date_from): + # locale = self.env.context.get('lang') or 'en_US' + # new_dates = tools.ustr(babel.dates.format_date(date=date_from, format='MMMM y', locale=locale)) + # return new_date + + '''@api.multi + @api.constrains('date_start','date_stop') + def _check_period(self): + for rec in self: + if rec.date_start and rec.date_stop: + if rec.date_start > rec.date_stop: + raise ValidationError(_('The start date must be before end date.')) + fiscal_rec_start = self.search([('date_start','<=',rec.date_start),('date_stop','>=',rec.date_start),('id','!=',rec.id)]) + if fiscal_rec_start: + raise ValidationError(_('The start date is within other fiscal year period.')) + fiscal_rec_end = self.search([('date_start','<=',rec.date_stop),('date_stop','>=',rec.date_stop),('id','!=',rec.id)]) + if fiscal_rec_end: + raise ValidationError(_('The end date is within other fiscal year period.'))''' + _sql_constraints = [ + ('fiscalyear_uniq', 'unique(fiscal_year_id)', 'The Fiscal Year must be unique For Periods!') + ] + + @api.constrains('date_start', 'date_stop', 'company_id') + def _check_dates(self): + for fy in self: + # Starting date must be prior to the ending date + date_from = fy.date_start + date_to = fy.date_stop + if date_to < date_from: + raise ValidationError(_('The ending date must not be prior to the starting date.')) + + + domain = [ + ('id', '!=', fy.id), + ('company_id', '=', fy.company_id.id), + '|', '|', + '&', ('date_start', '<=', fy.date_start), ('date_stop', '>=', fy.date_start), + '&', ('date_start', '<=', fy.date_stop), ('date_stop', '>=', fy.date_stop), + '&', ('date_start', '<=', fy.date_start), ('date_stop', '>=', fy.date_stop), + ] + + if self.search_count(domain) > 0: + raise ValidationError(_('You can not have an overlap between two fiscal years, please correct the start and/or end dates of your fiscal years.')) + + + + def create_periods(self): + period_obj = self.env['account.month.period'] + for rec in self: + rec.period_ids.unlink() + start_date = fields.Date.from_string(rec.date_start) + end_date = fields.Date.from_string(rec.date_stop) + index = 1 + while start_date < end_date: + de = start_date + relativedelta(months=1, days=-1) + + if de > end_date: + de = end_date + + period_obj.create({ + 'sequence': index, + 'code': '%02d/' % int(index) + start_date.strftime('%Y'), + 'date_start': start_date.strftime('%Y-%m-%d'), + 'date_stop': de.strftime('%Y-%m-%d'), + 'fiscalyear_id': rec.id, + }) + start_date = start_date + relativedelta(months=1) + index += 1 + +class AccountMonthPeriod(models.Model): + _name = "account.month.period" + _description = "Account Month period" + _inherit = ['mail.thread'] + _order = "date_start asc" + + sequence = fields.Integer('Period Sequence', default=1) + code = fields.Char('Code', size=14, tracking=True) + special = fields.Boolean('Opening/Closing Period', tracking=True) + date_start = fields.Date('From', required=True, tracking=True) + date_stop = fields.Date('To', required=True, tracking=True) + fiscalyear_id = fields.Many2one('account.fiscalyear.periods', 'Fiscal Year', select=True, tracking=True) + company_id = fields.Many2one('res.company',string='Company',related='fiscalyear_id.company_id') + + def get_closest_open_date(self,dates): + period = self.sudo().search([('date_start', '<=', dates), ('date_stop', '>=', dates),('special','=',True)]) + if period: + return dates + else: + period = self.sudo().search([('date_start', '>=', dates),('special','=',True)],limit=1) + if period: + return period.date_start + else: + return dates + + + def get_closest_open_by_period(self,dates): + period = self.sudo().search([('date_start', '<=', dates), ('date_stop', '>=', dates),('special','=',True)]) + if period: + return {'date_from':period['date_start'],'date_to':period['date_stop']} + else: + period = self.sudo().search([('special','=',True)],order='date_start desc',limit=1) + if period: + return {'date_from':period['date_start'],'date_to':period['date_stop']} + else: + return False + +class AccountMove(models.Model): + _inherit = 'account.move' + + def _check_fiscalyear_lock_date(self): + res = super(AccountMove, self)._check_fiscalyear_lock_date() + if res: + for rec in self: + fiscal_year_obj = self.env['account.fiscalyear.periods'] + period_obj = self.env['account.month.period'] + fiscal_rec = fiscal_year_obj.sudo().search([('date_start','<=',rec.date),('date_stop','>=',rec.date)]) + if not fiscal_rec: + raise ValidationError(_('The date must be within the fiscal year period')) + elif fiscal_rec.state == 'open': + period_rec = period_obj.sudo().search([('date_start', '<=', rec.date), ('date_stop', '>=', rec.date)]) + if not period_rec: + raise ValidationError( + _('The date must be within the period duration.')) + elif not period_rec.special: + raise ValidationError(_('The Fiscal year period is closed')) + else:return True + else:raise ValidationError( + _('The Fiscal year must opened first')) + else: return res diff --git a/account_fiscal_year_period/security/groups.xml b/account_fiscal_year_period/security/groups.xml new file mode 100644 index 0000000..6628d59 --- /dev/null +++ b/account_fiscal_year_period/security/groups.xml @@ -0,0 +1,27 @@ + + + + + Fiscal Year Period + + 114 + + + Allow to define fiscal years of more or less than a year + + + + Create Periods + + + + Close Period + + + + Open/Close Month + + + + + diff --git a/account_fiscal_year_period/security/ir.model.access.csv b/account_fiscal_year_period/security/ir.model.access.csv new file mode 100644 index 0000000..a547f25 --- /dev/null +++ b/account_fiscal_year_period/security/ir.model.access.csv @@ -0,0 +1,10 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_account_fiscal_year,access.account.fiscal.year,model_account_fiscal_year,account_fiscal_year_period.group_define_fiscal_year,1,1,1,1 +access_account_fiscal_year_create,access_account_fiscal_year_create,model_account_fiscalyear_periods,account_fiscal_year_period.group_fiscal_year_create,1,1,1,0 +access_account_fiscal_year_line_create,access_account_fiscal_year_line_create,model_account_month_period,account_fiscal_year_period.group_fiscal_year_create,1,1,1,0 +access_account_fiscal_year_open_close,access_account_fiscal_year_open_close,model_account_fiscalyear_periods,account_fiscal_year_period.group_fiscal_year_open_close,1,1,0,0 +access_account_fiscal_year_line_open_close,access_account_fiscal_year_line_open_close,model_account_month_period,account_fiscal_year_period.group_fiscal_year_open_close,1,1,0,0 +access_account_fiscal_year_conf_create,access_account_fiscal_year_conf_create,model_account_fiscal_year,account_fiscal_year_period.group_fiscal_year_create,1,0,0,0 +access_account_fiscal_year_conf_open_close,access_account_fiscal_year_conf_open_close,model_account_fiscal_year,account_fiscal_year_period.group_fiscal_year_open_close,1,0,0,0 +access_account_fiscal_year_close,access_account_fiscal_year_close,model_account_fiscalyear_periods,account_fiscal_year_period.group_fiscal_year_close,1,1,1,0 +access_account_fiscal_year_line_close,access_account_fiscal_year_line_close,model_account_month_period,account_fiscal_year_period.group_fiscal_year_close,1,1,1,0 diff --git a/account_fiscal_year_period/static/description/check_to_open_or_close_period.png b/account_fiscal_year_period/static/description/check_to_open_or_close_period.png new file mode 100644 index 0000000..3e718f2 Binary files /dev/null and b/account_fiscal_year_period/static/description/check_to_open_or_close_period.png differ diff --git a/account_fiscal_year_period/static/description/close_check.png b/account_fiscal_year_period/static/description/close_check.png new file mode 100644 index 0000000..4f73527 Binary files /dev/null and b/account_fiscal_year_period/static/description/close_check.png differ diff --git a/account_fiscal_year_period/static/description/define_fiscal_period.png b/account_fiscal_year_period/static/description/define_fiscal_period.png new file mode 100644 index 0000000..d514aa5 Binary files /dev/null and b/account_fiscal_year_period/static/description/define_fiscal_period.png differ diff --git a/account_fiscal_year_period/static/description/define_fiscal_year.png b/account_fiscal_year_period/static/description/define_fiscal_year.png new file mode 100644 index 0000000..be0f195 Binary files /dev/null and b/account_fiscal_year_period/static/description/define_fiscal_year.png differ diff --git a/account_fiscal_year_period/static/description/generate_period_by_month.png b/account_fiscal_year_period/static/description/generate_period_by_month.png new file mode 100644 index 0000000..46e2ca1 Binary files /dev/null and b/account_fiscal_year_period/static/description/generate_period_by_month.png differ diff --git a/account_fiscal_year_period/static/description/group.png b/account_fiscal_year_period/static/description/group.png new file mode 100644 index 0000000..e39e7bf Binary files /dev/null and b/account_fiscal_year_period/static/description/group.png differ diff --git a/account_fiscal_year_period/static/description/icon.png b/account_fiscal_year_period/static/description/icon.png new file mode 100644 index 0000000..9d403bb Binary files /dev/null and b/account_fiscal_year_period/static/description/icon.png differ diff --git a/account_fiscal_year_period/static/description/index.html b/account_fiscal_year_period/static/description/index.html new file mode 100644 index 0000000..a17d9df --- /dev/null +++ b/account_fiscal_year_period/static/description/index.html @@ -0,0 +1,134 @@ +
+
+
+

+ Account Fiscal Year Period +

+
+ +
+
    +
  • + Features +
      +
    • + Allow User To Define Fiscal + Year +
    • +
    • + Allow User To Generate Periods + For Fiscal Year (By Month) +
    • +
    • + Allow User To Open Or Close Any + Month Of The Period +
    • +
    • + Module Will Prevent Post Entry + If It's Date In: +
    • Not Defined Fiscal Year
    • +
    • Not Define Perid Record For Fiscal Year
    • +
    • Not Open Perid Record For Fiscal Year
    • +
    • Closed Month Period
    • + +
    • + + Add Security Groups: +
    • + Fiscal Year Period : For Create Fiscal Year Period Record. +
    • +
    • + Create Periods : For Generate Months For Fiscal Year Period +
    • +
    • Close Period : For Close All Period
    • +
    • + Open/Close Month : For Open Or Close Any Month Of The Period +
    • +
      + +
    +
  • +
+
+
+
+
+
+
+
+

Group In User .

+ + + +
+
+

Fiscal Year And Period Menu

+ + + +
+
+

+ Define Fiscal Year (Object Already In Odoo ,But We Add Menu For It + Here) +

+ + + +
+ +
+

+ Define Fiscal Year Period Record(By Select Fiscal Year) +

+ + + +
+ +
+

Generate Period For Fiscal Year (By Month)

+ + + +
+ +
+

+ Open Or Close Month (By Check You Open The Month,Un-check That Close The Month) + + +

+ +
+

+ If Month Is Close (Un-check) Module Prevent Post Entry,Or Invoice Validate In It, +

+ + + + + + +
+
+
+
diff --git a/account_fiscal_year_period/static/description/inv.png b/account_fiscal_year_period/static/description/inv.png new file mode 100644 index 0000000..adacf5d Binary files /dev/null and b/account_fiscal_year_period/static/description/inv.png differ diff --git a/account_fiscal_year_period/static/description/menu.png b/account_fiscal_year_period/static/description/menu.png new file mode 100644 index 0000000..2377ee5 Binary files /dev/null and b/account_fiscal_year_period/static/description/menu.png differ diff --git a/account_fiscal_year_period/views/fiscal_year.xml b/account_fiscal_year_period/views/fiscal_year.xml new file mode 100644 index 0000000..9fc6c89 --- /dev/null +++ b/account_fiscal_year_period/views/fiscal_year.xml @@ -0,0 +1,56 @@ + + + + + account.fiscal.year.tree + account.fiscal.year + + + + + + + + + + + account.fiscal.year.form + account.fiscal.year + +
+ + + + + + + + + + + + +
+
+
+ + + Fiscal Years + account.fiscal.year + tree,form + +

+ Click here to create a new fiscal year. +

+
+
+ + + + +
\ No newline at end of file diff --git a/account_fiscal_year_period/views/views.xml b/account_fiscal_year_period/views/views.xml new file mode 100644 index 0000000..b3cba7e --- /dev/null +++ b/account_fiscal_year_period/views/views.xml @@ -0,0 +1,129 @@ + + + + + + account.fiscalyear.periods.form + account.fiscalyear.periods + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+
+
+
+ + + account.month.period.view.form + account.month.period + +
+ + + + + + + + + +
+
+
+ + + + + account.fiscalyear.periods.tree + account.fiscalyear.periods + + + + + + + + + + + + + + + + Fiscal Years + account.fiscalyear.periods + tree,form + +

+ Click to start a new fiscal year. +

+

+ Define your company's financial year according to your needs. A + financial year is a period at the end of which a company's + accounts are made up (usually 12 months). The financial year is + usually referred to by the date in which it ends. For example, + if a company's financial year ends November 30, 2011, then + everything between December 1, 2010 and November 30, 2011 + would be referred to as FY 2011. +

+
+
+ + + +
+
\ No newline at end of file -- cgit v1.2.3