diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py
index e63927b99a5..5670a903b40 100644
--- a/addons/l10n_in/models/account_invoice.py
+++ b/addons/l10n_in/models/account_invoice.py
@@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
-from odoo.exceptions import ValidationError
+from odoo.exceptions import ValidationError, RedirectWarning
class AccountMove(models.Model):
@@ -56,11 +56,16 @@ class AccountMove(models.Model):
self._fields['l10n_in_gst_treatment']._description_selection(self.env)}
for move in posted.filtered(lambda m: m.country_code == 'IN'):
if not move.company_id.state_id:
- raise ValidationError(_(
- "State is missing from your company %(company_name)s (%(company_id)s).\nFirst set state in your company.",
- company_name=move.company_id.name,
- company_id=move.company_id.id
- ))
+ msg = _("Your company %s needs to have a correct address in order to validate this invoice.\n"
+ "Set the address of your company (Don't forget the State field)") % (move.company_id.name)
+ action = {
+ "view_mode": "form",
+ "res_model": "res.company",
+ "type": "ir.actions.act_window",
+ "res_id" : move.company_id.id,
+ "views": [[self.env.ref("base.view_company_form").id, "form"]],
+ }
+ raise RedirectWarning(msg, action, _('Go to Company configuration'))
elif move.journal_id.type == 'purchase':
move.l10n_in_state_id = move.company_id.state_id
diff --git a/addons/l10n_in/models/chart_template.py b/addons/l10n_in/models/chart_template.py
index f218bf66142..4dee7db6718 100644
--- a/addons/l10n_in/models/chart_template.py
+++ b/addons/l10n_in/models/chart_template.py
@@ -7,18 +7,14 @@ 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['code'] == 'INV':
- journal['name'] = _('Tax Invoices')
- return res
-
def _load(self, company):
+ """ Set Opening Date and Fiscal Year End in Indian localization"""
res = super(AccountChartTemplate, self)._load(company)
if self == self.env.ref("l10n_in.indian_chart_template_standard"):
- company.write({'fiscalyear_last_month': '3'})
+ company.write({
+ 'account_opening_date': fields.Date.context_today(self).replace(month=4, day=1),
+ 'fiscalyear_last_month': '3',
+ })
return res
diff --git a/addons/l10n_in/models/res_config_settings.py b/addons/l10n_in/models/res_config_settings.py
index 11a58d953fa..fb1734a5311 100644
--- a/addons/l10n_in/models/res_config_settings.py
+++ b/addons/l10n_in/models/res_config_settings.py
@@ -8,3 +8,4 @@ class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
group_l10n_in_reseller = fields.Boolean(implied_group='l10n_in.group_l10n_in_reseller', string="Manage Reseller(E-Commerce)")
+ module_l10n_in_edi = fields.Boolean('Indian Electronic Invoicing')
diff --git a/addons/l10n_in/views/res_config_settings_views.xml b/addons/l10n_in/views/res_config_settings_views.xml
index 198c95cab11..d0e1013330f 100644
--- a/addons/l10n_in/views/res_config_settings_views.xml
+++ b/addons/l10n_in/views/res_config_settings_views.xml
@@ -9,6 +9,9 @@
+
+
+
diff --git a/addons/l10n_in_edi/models/account_edi_format.py b/addons/l10n_in_edi/models/account_edi_format.py
index 12768ae2ca3..2c6304240ab 100644
--- a/addons/l10n_in_edi/models/account_edi_format.py
+++ b/addons/l10n_in_edi/models/account_edi_format.py
@@ -594,10 +594,10 @@ class AccountEdiFormat(models.Model):
@api.model
def _l10n_in_edi_no_config_response(self):
return {'error': [{
- 'code': '000',
+ 'code': '0',
'message': _(
- "A username and password still needs to be set or it's wrong for the E-invoice(IN). "
- "It needs to be added and verify in the Settings."
+ "Unable to send e-Invoice."
+ "Create an API user in NIC portal, and set it using the top menu: Configuration > Settings."
)}
]}
diff --git a/addons/l10n_in_edi/models/res_config_settings.py b/addons/l10n_in_edi/models/res_config_settings.py
index 7e2a2fca8e7..566e6fb25e1 100644
--- a/addons/l10n_in_edi/models/res_config_settings.py
+++ b/addons/l10n_in_edi/models/res_config_settings.py
@@ -19,4 +19,4 @@ class ResConfigSettings(models.TransientModel):
def l10n_in_edi_test(self):
self.env["account.edi.format"]._l10n_in_edi_authenticate(self.company_id)
if not self.company_id.sudo()._l10n_in_edi_token_is_valid():
- raise UserError(_("Username/password are incorrect."))
+ raise UserError(_("Incorrect username or password, or the GST number on company does not match."))
diff --git a/addons/l10n_in_edi/views/edi_pdf_report.xml b/addons/l10n_in_edi/views/edi_pdf_report.xml
index b53d36bef6a..dc2cd15b1f6 100644
--- a/addons/l10n_in_edi/views/edi_pdf_report.xml
+++ b/addons/l10n_in_edi/views/edi_pdf_report.xml
@@ -1,31 +1,78 @@
-
-
-
-