diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 17:14:58 +0700 |
| commit | 1ca3b3df3421961caec3b747a364071c80f5c7da (patch) | |
| tree | 6778a1f0f3f9b4c6e26d6d87ccde16e24da6c9d6 /account_fiscal_year_period | |
| parent | b57188be371d36d96caac4b8d65a40745c0e972c (diff) | |
initial commit
Diffstat (limited to 'account_fiscal_year_period')
21 files changed, 877 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<odoo> + <data> + <record id="seq_account_fiscal_year_period" model="ir.sequence"> + <field name="name">account.fiscal.period.sequence</field> + <field name="code">account.fiscal.period.year</field> + <field name="prefix">Fiscal/</field> + <field name="padding">4</field> + </record> + </data> +</odoo>
\ 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<odoo> + <data noupdate="0"> + <record model="ir.module.category" id="module_category_fiscal_year"> + <field name="name">Fiscal Year Period</field> + <field name="description"></field> + <field name="sequence">114</field> + </record> + <record id="group_define_fiscal_year" model="res.groups"> + <field name="name">Allow to define fiscal years of more or less than a year</field> + <field name="category_id" ref="module_category_fiscal_year"/> + </record> + <record id="group_fiscal_year_create" model="res.groups"> + <field name="name">Create Periods</field> + <field name="category_id" ref="module_category_fiscal_year"/> + </record> + <record id="group_fiscal_year_close" model="res.groups"> + <field name="name">Close Period</field> + <field name="category_id" ref="module_category_fiscal_year"/> + </record> + <record id="group_fiscal_year_open_close" model="res.groups"> + <field name="name">Open/Close Month</field> + <field name="category_id" ref="module_category_fiscal_year"/> + </record> + + </data> +</odoo> 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 Binary files differnew file mode 100644 index 0000000..3e718f2 --- /dev/null +++ b/account_fiscal_year_period/static/description/check_to_open_or_close_period.png diff --git a/account_fiscal_year_period/static/description/close_check.png b/account_fiscal_year_period/static/description/close_check.png Binary files differnew file mode 100644 index 0000000..4f73527 --- /dev/null +++ b/account_fiscal_year_period/static/description/close_check.png diff --git a/account_fiscal_year_period/static/description/define_fiscal_period.png b/account_fiscal_year_period/static/description/define_fiscal_period.png Binary files differnew file mode 100644 index 0000000..d514aa5 --- /dev/null +++ b/account_fiscal_year_period/static/description/define_fiscal_period.png diff --git a/account_fiscal_year_period/static/description/define_fiscal_year.png b/account_fiscal_year_period/static/description/define_fiscal_year.png Binary files differnew file mode 100644 index 0000000..be0f195 --- /dev/null +++ b/account_fiscal_year_period/static/description/define_fiscal_year.png 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 Binary files differnew file mode 100644 index 0000000..46e2ca1 --- /dev/null +++ b/account_fiscal_year_period/static/description/generate_period_by_month.png diff --git a/account_fiscal_year_period/static/description/group.png b/account_fiscal_year_period/static/description/group.png Binary files differnew file mode 100644 index 0000000..e39e7bf --- /dev/null +++ b/account_fiscal_year_period/static/description/group.png diff --git a/account_fiscal_year_period/static/description/icon.png b/account_fiscal_year_period/static/description/icon.png Binary files differnew file mode 100644 index 0000000..9d403bb --- /dev/null +++ b/account_fiscal_year_period/static/description/icon.png 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 @@ +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <h2 class="oe_slogan"> + <font color="#3b5998"><u>Account Fiscal Year Period</u></font> + </h2> + </div> + + <div class="panel-body"> + <ul class="list-unstyled"> + <li> + <span class="text-primary"><b> Features </b></span> + <ul class="list-unstyled"> + <li class="text-primary"> + <i class="fa fa-hand-o-right"></i> Allow User To Define Fiscal + Year + </li> + <li class="text-primary"> + <i class="fa fa-hand-o-right"></i>Allow User To Generate Periods + For Fiscal Year (By Month) + </li> + <li class="text-primary"> + <i class="fa fa-hand-o-right"></i>Allow User To Open Or Close Any + Month Of The Period + </li> + <li class="text-primary"> + <i class="fa fa-hand-o-right"></i> Module Will Prevent Post Entry + If It's Date In: + <li>Not Defined Fiscal Year</li> + <li>Not Define Perid Record For Fiscal Year</li> + <li>Not Open Perid Record For Fiscal Year</li> + <li>Closed Month Period</li> + </li> + <li class="text-primary"> + <i class="fa fa-hand-o-right"> + Add Security Groups: + <li> + <b>Fiscal Year Period :</b> For Create Fiscal Year Period Record. + </li> + <li> + <b>Create Periods :</b> For Generate Months For Fiscal Year Period + </li> + <li><b>Close Period :</b> For Close All Period</li> + <li> + <b>Open/Close Month :</b> For Open Or Close Any Month Of The Period + </li> + </i> + </li> + </ul> + </li> + </ul> + </div> + </div> +</section> +<section class="oe_container"> + <div class="oe_row oe_spaced"> + <div class="oe_span12"> + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan">Group In User .</h4> + <a href="group.png"> + <img class="img-border img-responsive thumbnail" src="group.png" /> + </a> + </div> + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan">Fiscal Year And Period Menu</h4> + <a href="menu.png"> + <img class="img-border img-responsive thumbnail" src="menu.png" /> + </a> + </div> + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan"> + Define Fiscal Year (Object Already In Odoo ,But We Add Menu For It + Here) + </h4> + <a href="define_fiscal_year.png"> + <img + class="img-border img-responsive thumbnail" + src="define_fiscal_year.png" + /> + </a> + </div> + + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan"> + Define Fiscal Year Period Record(By Select Fiscal Year) + </h4> + <a href="define_fiscal_period.png"> + <img + class="img-border img-responsive thumbnail" + src="define_fiscal_period.png" + /> + </a> + </div> + + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan">Generate Period For Fiscal Year (By Month)</h4> + <a href="generate_period_by_month.png"> + <img + class="img-border img-responsive thumbnail" + src="generate_period_by_month.png" + /> + </a> + </div> + + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan"> + Open Or Close Month (By Check You Open The Month,Un-check That Close The Month) + <img + class="img-border img-responsive thumbnail" + src="check_to_open_or_close_period.png" + /> + </a> + </div> + + <div class="col-md-12" style="padding-left: 0px"> + <h4 class="oe_slogan"> + If Month Is Close (Un-check) Module Prevent Post Entry,Or Invoice Validate In It, + </h4> + <a href="close_check.jpg"> + <img + class="img-border img-responsive thumbnail" + src="close_check.png" + /> + </a> + <a href="inv.jpg"> + <img + class="img-border img-responsive thumbnail" + src="inv.png" + /> + </a> + </div> + </div> + </div> +</section> diff --git a/account_fiscal_year_period/static/description/inv.png b/account_fiscal_year_period/static/description/inv.png Binary files differnew file mode 100644 index 0000000..adacf5d --- /dev/null +++ b/account_fiscal_year_period/static/description/inv.png diff --git a/account_fiscal_year_period/static/description/menu.png b/account_fiscal_year_period/static/description/menu.png Binary files differnew file mode 100644 index 0000000..2377ee5 --- /dev/null +++ b/account_fiscal_year_period/static/description/menu.png 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + + <record id="view_account_fiscal_year_tree" model="ir.ui.view"> + <field name="name">account.fiscal.year.tree</field> + <field name="model">account.fiscal.year</field> + <field name="arch" type="xml"> + <tree> + <field name="name"/> + <field name="date_from"/> + <field name="date_to"/> + </tree> + </field> + </record> + + <record id="view_account_fiscal_year_form" model="ir.ui.view"> + <field name="name">account.fiscal.year.form</field> + <field name="model">account.fiscal.year</field> + <field name="arch" type="xml"> + <form> + <sheet> + <group> + <group> + <field name="name"/> + <field name="company_id"/> + </group> + <group> + <field name="date_from"/> + <field name="date_to"/> + </group> + </group> + </sheet> + </form> + </field> + </record> + + <record id="actions_account_fiscal_year" model="ir.actions.act_window"> + <field name="name">Fiscal Years</field> + <field name="res_model">account.fiscal.year</field> + <field name="view_mode">tree,form</field> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click here to create a new fiscal year. + </p> + </field> + </record> + <menuitem id="account_fiscal_year" name="Fiscal Years And Periods" parent="account.menu_finance_configuration" sequence="1" /> + + <menuitem id="menu_fiscal_year" + name="Fiscal Year" + sequence="1" + parent="account_fiscal_year_period.account_fiscal_year" + action="actions_account_fiscal_year" + groups="account_fiscal_year_period.group_define_fiscal_year"/> + +</odoo>
\ 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 @@ +<odoo> + <data> + + <!-- Fiscal Year --> + <record id="view_account_fiscalyear_periods_form" model="ir.ui.view"> + <field name="name">account.fiscalyear.periods.form</field> + <field name="model">account.fiscalyear.periods</field> + <field name="arch" type="xml"> + <form string="Fiscal year" version="7.0"> + <header> + <button name="create_periods" groups="account_fiscal_year_period.group_fiscal_year_create" states="draft" string="Create Periods" type="object" class="oe_highlight"/> + <button name="open" states="draft" groups="account_fiscal_year_period.group_fiscal_year_create" string="Open" type="object" class="oe_highlight"/> + <button name="done" states="open" string="Close" groups="account_fiscal_year_period.group_fiscal_year_close" type="object" class="oe_highlight" confirm="are you sure closed year and periods?"/> + <button name="set_to_draft" states="open,done" groups="account_fiscal_year_period.group_fiscal_year_create" string="Set To Draft" type="object" class="oe_highlight"/> + <field name="state" widget="statusbar" nolabel="1" statusbar_visible="draft,open" /> + </header> + <sheet> + <group> + <group> + <field name="code" force_save="1"/> + <field name="fiscal_year_id" attrs="{'readonly':[('state','!=','draft')]}"/> + <field name="company_id" groups="base.group_multi_company" readonly='1'/> + </group> + <group> + <field name="date_start" required="1" readonly="1"/> + <field name="date_stop" readonly="1" required="1"/> + </group> + </group> + <notebook> + <page string="Periods"> + <field colspan="4" name="period_ids" nolabel="1" widget="one2many_list" attrs="{'readonly':[('state','!=','open')]}"> + <tree colors="blue:parent.state == 'draft';green:special==True;gray:special !=true" string="Period" editable="bottom" create="false" delete="false"> + <field name="sequence" readonly="1"/> + <field name="code" readonly="1"/> + <field name="date_start" readonly="1"/> + <field name="date_stop" readonly="1"/> + <field name="special" groups="account_fiscal_year_period.group_fiscal_year_open_close"/> + </tree> + </field> + </page> + </notebook> + <div> + <label for="comments"/> + <field name="comments" attrs="{'readonly':[('state','!=','draft')]}"/> + </div> + </sheet> + <div class="oe_chatter"> + <field name="message_ids" widget="mail_thread"/> + </div> + </form> + </field> + </record> + + <record id="account_month_period_view_form" model="ir.ui.view"> + <field name="name">account.month.period.view.form</field> + <field name="model">account.month.period</field> + <field name="arch" type="xml"> + <form string=""> + <sheet> + <group> + <field name="sequence" readonly="1"/> + <field name="code" readonly="1"/> + <field name="date_start" readonly="1"/> + <field name="date_stop" readonly="1"/> + <field name="special"/> + </group> + </sheet> + </form> + </field> + </record> + + + + <record id="view_account_fiscalyear_periods_tree" model="ir.ui.view"> + <field name="name">account.fiscalyear.periods.tree</field> + <field name="model">account.fiscalyear.periods</field> + <field name="arch" type="xml"> + <tree decoration-info="state == 'draft'" decoration-success="state == 'open'" string="Fiscalyear"> + <field name="code"/> + <field name="fiscal_year_id"/> + <field name="company_id" groups="base.group_multi_company"/> + <field name="state"/> + <field name="date_start"/> + <field name="date_stop"/> + </tree> + </field> + </record> + + <!--record id="view_account_fiscalyear_periods_search" model="ir.ui.view"> + <field name="name">account.fiscalyear.periods.search</field> + <field name="model">account.fiscalyear.periods</field> + <field name="arch" type="xml"> + <search string="Search Fiscalyear"> + <field name="fiscal_year_id" string="Fiscal Year"/> + <filter string="Open" domain="[('state','=','open')]" icon="terp-camera_test"/> + <filter string="Closed" domain="[('state','=','done')]" icon="terp-dialog-close"/> + <field name="state"/> + <group expand="0" string="Group By..."> + <filter string="Status" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/> + <filter sting="Fiscal Year" context="{'group_by':'fiscal_year_id'}" /> + </group> + </search> + </field> + </record--> + + <record id="action_account_fiscalyear" model="ir.actions.act_window"> + <field name="name">Fiscal Years</field> + <field name="res_model">account.fiscalyear.periods</field> + <field name="view_mode">tree,form</field> + <field name="help" type="html"> + <p class="oe_view_nocontent_create"> + Click to start a new fiscal year. + </p> + <p> + 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. + </p> + </field> + </record> + + + <menuitem id="menu_action_account_fiscalyear" name="Fiscal Year Periods" action="action_account_fiscalyear" parent="account_fiscal_year_period.account_fiscal_year"/> + </data> +</odoo>
\ No newline at end of file |
