GST Treatment: * Is show that how This invoice or partner is treated in GST * Set default value in customer * This is help in GST retrun filing. * Value of treamtmnet as below - Registered Business - Regular - Registered Business - Composition - Unregistered Business - Consumer - Overseas - Special Economic Zone - Deemed Export * GSTIN is required in - Registered Business - Regular - Registered Business - Composition - Special Economic Zone - Deemed Export GSTIN: * GST identification number or GST number * There can be multiple GSTIN for a single person, being an assessee under the Income Tax Act for every State or Union Territory in which such person operates from * Add Validate of this number using regular expression remove field l10n_in_export_type and l10n_in_import_export becouse it's covered by GST Treatment remove field l10n_in_partner_vat becouse not use anyware.
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models, _
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
l10n_in_gst_treatment = fields.Selection([
|
|
('regular', 'Registered Business - Regular'),
|
|
('composition', 'Registered Business - Composition'),
|
|
('unregistered', 'Unregistered Business'),
|
|
('consumer', 'Consumer'),
|
|
('overseas', 'Overseas'),
|
|
('special_economic_zone', 'Special Economic Zone'),
|
|
('deemed_export', 'Deemed Export'),
|
|
], string="GST Treatment")
|
|
|
|
@api.onchange('company_type')
|
|
def onchange_company_type(self):
|
|
res = super().onchange_company_type()
|
|
if self.country_id and self.country_id.code == 'IN':
|
|
self.l10n_in_gst_treatment = (self.company_type == 'company') and 'regular' or 'consumer'
|
|
return res
|
|
|
|
@api.onchange('country_id')
|
|
def _onchange_country_id(self):
|
|
res = super()._onchange_country_id()
|
|
if self.country_id and self.country_id.code != 'IN':
|
|
self.l10n_in_gst_treatment = 'overseas'
|
|
elif self.country_id and self.country_id.code == 'IN':
|
|
self.l10n_in_gst_treatment = (self.company_type == 'company') and 'regular' or 'consumer'
|
|
return res
|
|
|
|
@api.onchange('vat')
|
|
def onchange_vat(self):
|
|
if self.vat and self.check_vat_in(self.vat):
|
|
state_id = self.env['res.country.state'].search([('l10n_in_tin', '=', self.vat[:2])], limit=1)
|
|
if state_id:
|
|
self.state_id = state_id
|
|
|
|
@api.model
|
|
def _commercial_fields(self):
|
|
res = super()._commercial_fields()
|
|
return res + ['l10n_in_gst_treatment']
|