summaryrefslogtreecommitdiff
path: root/addons/l10n_in/models
diff options
context:
space:
mode:
authorJigar Vaghela <jva@odoo.com>2019-09-26 07:13:26 +0000
committerJigar Vaghela <jva@odoo.com>2019-09-27 11:39:39 +0000
commitea9e8a37d6f7bc58ee5d323830310173c33ed20d (patch)
tree46c567023681b2765d1ac299bca619bab14d86a3 /addons/l10n_in/models
parent85eeaccf065b151dbc9f0e1a24f1b4f674dec6cc (diff)
[IMP] l10n_in*: multi GSTIN Using journal
======= Purpose ======= government rule that "GST registration should be obtained by a taxable person under GST in each of the State or Union Territory, from where the taxable supply of goods or services is made" So we managed this using journal User create journal and partner for other states After user can select journal in Sale order, Purchase order and warehouse ======== Solution ======== -Add a field on the journal to define the GSTIN -Add sale and purchase journal field in warehouse -On the SO/PO, add the journal field and based on the warehouse journal it set automatically fill if warehouse journal is set. task 1917619
Diffstat (limited to 'addons/l10n_in/models')
-rw-r--r--addons/l10n_in/models/account.py16
-rw-r--r--addons/l10n_in/models/chart_template.py6
2 files changed, 20 insertions, 2 deletions
diff --git a/addons/l10n_in/models/account.py b/addons/l10n_in/models/account.py
index b28d6a1ab33..eb10eced9b9 100644
--- a/addons/l10n_in/models/account.py
+++ b/addons/l10n_in/models/account.py
@@ -10,6 +10,22 @@ class AccountJournal(models.Model):
# Use for filter import and export type.
l10n_in_import_export = fields.Boolean("Import/Export", help="Tick this if this journal is use for Import/Export Under Indian GST.")
+ l10n_in_gstin_partner_id = fields.Many2one('res.partner', string="GSTIN", ondelete="restrict", help="GSTIN related to this journal. If empty then consider as company GSTIN.")
+
+ def name_get(self):
+ """
+ Add GSTIN number in name as suffix so user can easily find the right journal.
+ Used super to ensure nothing is missed.
+ """
+ result = super().name_get()
+ result_dict = dict(result)
+ indian_journals = self.filtered(lambda j: j.company_id.country_id.code == 'IN' and
+ j.l10n_in_gstin_partner_id and j.l10n_in_gstin_partner_id.vat)
+ for journal in indian_journals:
+ name = result_dict[journal.id]
+ name += "- %s" % (journal.l10n_in_gstin_partner_id.vat)
+ result_dict[journal.id] = name
+ return list(result_dict.items())
class AccountMoveLine(models.Model):
diff --git a/addons/l10n_in/models/chart_template.py b/addons/l10n_in/models/chart_template.py
index 5fe711b4df7..39f3270b755 100644
--- a/addons/l10n_in/models/chart_template.py
+++ b/addons/l10n_in/models/chart_template.py
@@ -11,12 +11,14 @@ class AccountChartTemplate(models.Model):
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')
res += [
- {'type': 'sale', 'name': _('Retail Invoices'), 'code': 'RETINV', 'company_id': company.id, 'show_on_dashboard': True,},
- {'type': 'sale', 'name': _('Export Invoices'), 'code': 'EXPINV', 'company_id': company.id, 'show_on_dashboard': True, 'l10n_in_import_export': True}
+ {'type': 'sale', 'name': _('Retail Invoices'), 'code': 'RETINV', 'company_id': company.id, 'show_on_dashboard': True, 'l10n_in_gstin_partner_id': company.partner_id.id},
+ {'type': 'sale', 'name': _('Export Invoices'), 'code': 'EXPINV', 'company_id': company.id, 'show_on_dashboard': True, 'l10n_in_import_export': True, 'l10n_in_gstin_partner_id': company.partner_id.id}
]
return res