Merge branch 'master-account-fiscal' into 'master'

[ADD]: Fiscal Periods.

See merge request flectra-hq/flectra!75
This commit is contained in:
Parthiv Patel 2018-06-14 08:23:33 +00:00
commit e31492a01a
2 changed files with 46 additions and 5 deletions

View File

@ -7,6 +7,14 @@ from flectra import api, fields, models, _
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
def _default_fiscalyear_last_day(self):
return self.env.user.company_id.fiscalyear_last_day or 31
def _default_fiscalyear_last_month(self):
return self.env.user.company_id.fiscalyear_last_month or 12
has_accounting_entries = fields.Boolean(compute='_compute_has_chart_of_accounts')
currency_id = fields.Many2one('res.currency', related="company_id.currency_id", required=True,
string='Currency', help="Main currency of the company.")
@ -43,6 +51,15 @@ class ResConfigSettings(models.TransientModel):
tax_cash_basis_journal_id = fields.Many2one('account.journal', related='company_id.tax_cash_basis_journal_id', string="Tax Cash Basis Journal")
account_hide_setup_bar = fields.Boolean(string='Hide Setup Bar', related='company_id.account_setup_bar_closed',help="Tick if you wish to hide the setup bar on the dashboard")
fiscalyear_last_day = fields.Integer(related='company_id.fiscalyear_last_day',
default=lambda self: self._default_fiscalyear_last_day())
fiscalyear_last_month = fields.Selection([(1, 'January'), (2, 'February'), (3, 'March'), (4, 'April'), (5, 'May'), (6, 'June'), (7, 'July'), (8, 'August'), (9, 'September'), (10, 'October'), (11, 'November'), (12, 'December')],
related='company_id.fiscalyear_last_month', default=lambda self: self._default_fiscalyear_last_month())
period_lock_date = fields.Date(string="Lock Date for Non-Advisers", related='company_id.period_lock_date', help="Only users with the 'Adviser' role can edit accounts prior to and inclusive of this date. Use it for period locking inside an open fiscal year, for example.")
fiscalyear_lock_date = fields.Date(string="Lock Date", related='company_id.fiscalyear_lock_date', help="No users, including Advisers, can edit accounts prior to and inclusive of this date. Use it for fiscal year locking for example.")
@api.model
def get_values(self):
res = super(ResConfigSettings, self).get_values()

View File

@ -156,12 +156,36 @@
</div>
</div>
</div>
<t groups="account.group_account_user">
<h2>Fiscal Periods</h2>
<div class="row mt16 o_settings_container" id="accounting_reports">
<div class="col-xs-12 col-md-6 o_setting_box" id="fiscalyear" invisible="1"/>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<label string="Fiscal Year"/>
<div class="content-group">
<div class="row mt16">
<label string="Last Day" class="col-md-3 o_light_label"/>
<field name="fiscalyear_last_month" style="width: 100px; margin-right: 8px;"/>
<field name="fiscalyear_last_day" class="oe_inline"/>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<label string="Fiscal Period Closing"/>
<div class="content-group">
<div class="row mt16">
<label for="fiscalyear_lock_date" class="col-md-5 o_light_label"/>
<field name="fiscalyear_lock_date"/>
<label for="period_lock_date" class="col-md-5 o_light_label"/>
<field name="period_lock_date"/>
</div>
</div>
</div>
</div>
</div>
</t>
<h2>Customer Payments</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box">