Files
odoo_source/addons/l10n_in/models/chart_template.py
T
Mohammed Shekha 0fc93fb1e4 [IMP] l10n_in: change fiscalyear_last_month to march
With this commit: we are changing fiscalyear_last_month to March if
chart template is Indian chart template as fiscal year ends in 31 March
in India.

task-2723849

closes odoo/odoo#81982

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-04-19 14:19:40 +02:00

37 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
res = super(AccountChartTemplate, self)._prepare_all_journals(acc_template_ref, company, journals_dict=journals_dict)
if self == self.env.ref('l10n_in.indian_chart_template_standard'):
for journal in res:
if journal.get('type') in ('sale','purchase'):
journal['l10n_in_gstin_partner_id'] = company.partner_id.id
if journal['code'] == 'INV':
journal['name'] = _('Tax Invoices')
return res
def _load(self, company):
res = super(AccountChartTemplate, self)._load(company)
if self == self.env.ref("l10n_in.indian_chart_template_standard"):
company.write({'fiscalyear_last_month': '3'})
return res
class AccountTaxTemplate(models.Model):
_inherit = 'account.tax.template'
l10n_in_reverse_charge = fields.Boolean("Reverse charge", help="Tick this if this tax is reverse charge. Only for Indian accounting")
def _get_tax_vals(self, company, tax_template_to_tax):
val = super(AccountTaxTemplate, self)._get_tax_vals(company, tax_template_to_tax)
if self.tax_group_id:
val['l10n_in_reverse_charge'] = self.l10n_in_reverse_charge
return val