[IMP] l10n_in: simplify place of supply

We just set a place of supply(state_id) from partner_id in the Invoice/Bill if partner country is india because there are many complex cases so we can't get it automatically in all cases like
(a) where the supply involves movement of goods, whether by the supplier or
the recipient or by any other person, the place of supply of such goods shall be the
location of the goods at the time at which the movement of goods terminates for
delivery to the recipient;

(b) where the goods are delivered by the supplier to a recipient or any other
person on the direction of a third person, whether acting as an agent or otherwise,
before or during movement of goods, either by way of transfer of documents of title
to the goods or otherwise, it shall be deemed that the said third person has received
the goods and the place of supply of such goods shall be the principal place of business
of such person;

(c) where the supply does not involve movement of goods, whether by the
supplier or the recipient, the place of supply shall be the location of such goods at the
time of the delivery to the recipient;

(d) where the goods are assembled or installed at site, the place of supply shall
be the place of such installation or assembly;

(e) where the goods are supplied on board a conveyance, including a vessel, an
aircraft, a train or a motor vehicle, the place of supply shall be the location at which
such goods are taken on board.

we add new state "Other Country" to set place of supply(state_id) incase of partner country is not India
for more details check CHAPTER V here https://www.cbic.gov.in/resources//htdocs-cbec/gst/igst-act.pdf;jsessionid=63D695F612B9972934E8131415FEBA28

closes odoo/odoo#82011

closes odoo/odoo#109286

X-original-commit: https://github.com/odoo-dev/odoo/commit/b76ee098e2a4c4d26d6d1c689bb0750e770201dc
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Josse Colpaert <jco@odoo.com>
This commit is contained in:
Jigar Vaghela
2023-01-13 11:40:13 +01:00
parent 5d060079f0
commit f9efc2b75f
4 changed files with 24 additions and 26 deletions
@@ -8,6 +8,13 @@
<field name="l10n_in_tin">97</field>
</record>
<record id="state_in_oc" model="res.country.state">
<field name="name">Other Country</field>
<field name="code">IN_OC</field>
<field name="country_id" ref="base.in"/>
<field name="l10n_in_tin">96</field>
</record>
<record id="base.state_in_an" model="res.country.state">
<field name="l10n_in_tin">35</field>
</record>
+14 -20
View File
@@ -19,7 +19,7 @@ class AccountMove(models.Model):
('deemed_export', 'Deemed Export'),
('uin_holders', 'UIN Holders'),
], string="GST Treatment", compute="_compute_l10n_in_gst_treatment", store=True, readonly=False, copy=True)
l10n_in_state_id = fields.Many2one('res.country.state', string="Location of supply")
l10n_in_state_id = fields.Many2one('res.country.state', string="Place of supply", compute="_compute_l10n_in_state_id", store=True, readonly=False)
l10n_in_gstin = fields.Char(string="GSTIN")
# For Export invoice this data is need in GSTR report
l10n_in_shipping_bill_number = fields.Char('Shipping bill number', readonly=True, states={'draft': [('readonly', False)]})
@@ -37,17 +37,19 @@ class AccountMove(models.Model):
for record in self:
record.l10n_in_gst_treatment = record.partner_id.l10n_in_gst_treatment
@api.model
def _l10n_in_get_indian_state(self, partner):
"""In tax return filing, If customer is not Indian in that case place of supply is must set to Other Territory.
So we set Other Territory in l10n_in_state_id when customer(partner) is not Indian
Also we raise if state is not set in Indian customer.
State is big role under GST because tax type is depend on.for more information check this https://www.cbic.gov.in/resources//htdocs-cbec/gst/Integrated%20goods%20&%20Services.pdf"""
if partner.country_id and partner.country_id.code == 'IN' and not partner.state_id:
raise ValidationError(_("State is missing from address in '%s'. First set state after post this invoice again.", partner.name))
elif partner.country_id and partner.country_id.code != 'IN':
return self.env.ref('l10n_in.state_in_ot')
return partner.state_id
@api.depends('partner_id')
def _compute_l10n_in_state_id(self):
for move in self:
if move.country_code == 'IN':
country_code = move.partner_id.country_id.code
if country_code == 'IN':
move.l10n_in_state_id = move.partner_id.state_id
elif country_code:
move.l10n_in_state_id = self.env.ref('l10n_in.state_in_oc', raise_if_not_found=False)
else:
move.l10n_in_state_id = move.company_id.state_id
else:
move.l10n_in_state_id = False
def _post(self, soft=True):
"""Use journal type to define document type because not miss state in any entry including POS entry"""
@@ -66,9 +68,6 @@ class AccountMove(models.Model):
"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
move.l10n_in_gstin = move.partner_id.vat
if not move.l10n_in_gstin and move.l10n_in_gst_treatment in ['regular', 'composition', 'special_economic_zone', 'deemed_export']:
raise ValidationError(_(
@@ -77,11 +76,6 @@ class AccountMove(models.Model):
partner_id=move.partner_id.id,
name=gst_treatment_name_mapping.get(move.l10n_in_gst_treatment)
))
if move.journal_id.type == 'sale':
move.l10n_in_state_id = self._l10n_in_get_indian_state(move.partner_id)
#still state is not set then assumed that transaction is local like PoS so set state of company
if not move.l10n_in_state_id:
move.l10n_in_state_id = move.company_id.state_id
return posted
def _l10n_in_get_warehouse_address(self):
@@ -7,6 +7,8 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="country_code" invisible="1"/>
<field name="l10n_in_state_id"
attrs="{'invisible': ['|', ('country_code', '!=', 'IN'), ('move_type', '=', 'entry')], 'required': [('country_code', '=', 'IN'), ('move_type', '!=', 'entry')], 'readonly': [('state', '!=', 'draft')]}"/>
<field name="l10n_in_gst_treatment"
attrs="{'invisible': ['|', ('country_code', '!=', 'IN'), ('move_type', '=', 'entry')], 'required': [('country_code', '=', 'IN'), ('move_type', '!=', 'entry')], 'readonly': [('state', '!=', 'draft')]}"/>
</xpath>
+1 -6
View File
@@ -6,12 +6,7 @@
</xpath>
<xpath expr="//t[@t-set='address']" position="inside">
<t t-if="o.company_id.account_fiscal_country_id.code == 'IN' and o.l10n_in_state_id" class="mt16">
<t t-if="o.move_type in ('in_invoice', 'in_refund')">
Destination of supply: <span t-out="o.l10n_in_state_id.name"/>
</t>
<t t-if="o.move_type in ('out_invoice', 'out_refund')">
Place of supply: <span t-out="o.l10n_in_state_id.name"/>
</t>
Place of supply: <span t-esc="o.l10n_in_state_id.name"/>
</t>
</xpath>
<xpath expr="//div[@t-if='not is_html_empty(o.narration)']" position="before">