summaryrefslogtreecommitdiff
path: root/addons/l10n_pe/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_pe/models
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/l10n_pe/models')
-rw-r--r--addons/l10n_pe/models/__init__.py7
-rw-r--r--addons/l10n_pe/models/account_move.py8
-rw-r--r--addons/l10n_pe/models/account_tax.py62
-rw-r--r--addons/l10n_pe/models/l10n_latam_identification_type.py9
-rw-r--r--addons/l10n_pe/models/res_city.py9
-rw-r--r--addons/l10n_pe/models/res_city_district.py14
-rw-r--r--addons/l10n_pe/models/res_partner.py10
7 files changed, 119 insertions, 0 deletions
diff --git a/addons/l10n_pe/models/__init__.py b/addons/l10n_pe/models/__init__.py
new file mode 100644
index 00000000..7be3012e
--- /dev/null
+++ b/addons/l10n_pe/models/__init__.py
@@ -0,0 +1,7 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from . import account_tax
+from . import account_move
+from . import l10n_latam_identification_type
+from . import res_partner
+from . import res_city_district
+from . import res_city
diff --git a/addons/l10n_pe/models/account_move.py b/addons/l10n_pe/models/account_move.py
new file mode 100644
index 00000000..4c0062fd
--- /dev/null
+++ b/addons/l10n_pe/models/account_move.py
@@ -0,0 +1,8 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import models, fields
+
+
+class AccountMoveLine(models.Model):
+ _inherit = "account.move.line"
+
+ l10n_pe_group_id = fields.Many2one("account.group", related="account_id.group_id", store=True)
diff --git a/addons/l10n_pe/models/account_tax.py b/addons/l10n_pe/models/account_tax.py
new file mode 100644
index 00000000..6c0da4f4
--- /dev/null
+++ b/addons/l10n_pe/models/account_tax.py
@@ -0,0 +1,62 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import fields, models
+
+
+class AccountTax(models.Model):
+ _inherit = "account.tax"
+
+ l10n_pe_edi_tax_code = fields.Selection([
+ ('1000', 'IGV - General Sales Tax'),
+ ('1016', 'IVAP - Tax on Sale Paddy Rice'),
+ ('2000', 'ISC - Selective Excise Tax'),
+ ('7152', 'ICBPER - Plastic bag tax'),
+ ('9995', 'EXP - Exportation'),
+ ('9996', 'GRA - Free'),
+ ('9997', 'EXO - Exonerated'),
+ ('9998', 'INA - Unaffected'),
+ ('9999', 'OTROS - Other taxes')
+ ], 'EDI peruvian code')
+
+ l10n_pe_edi_unece_category = fields.Selection([
+ ('E', 'Exempt from tax'),
+ ('G', 'Free export item, tax not charged'),
+ ('O', 'Services outside scope of tax'),
+ ('S', 'Standard rate'),
+ ('Z', 'Zero rated goods')], 'EDI UNECE code',
+ help="Follow the UN/ECE 5305 standard from the United Nations Economic Commission for Europe for more "
+ "information http://www.unece.org/trade/untdid/d08a/tred/tred5305.htm"
+ )
+
+
+class AccountTaxTemplate(models.Model):
+ _inherit = "account.tax.template"
+
+ l10n_pe_edi_tax_code = fields.Selection([
+ ('1000', 'IGV - General Sales Tax'),
+ ('1016', 'IVAP - Tax on Sale Paddy Rice'),
+ ('2000', 'ISC - Selective Excise Tax'),
+ ('7152', 'ICBPER - Plastic bag tax'),
+ ('9995', 'EXP - Exportation'),
+ ('9996', 'GRA - Free'),
+ ('9997', 'EXO - Exonerated'),
+ ('9998', 'INA - Unaffected'),
+ ('9999', 'OTROS - Other taxes')
+ ], 'EDI peruvian code')
+
+ l10n_pe_edi_unece_category = fields.Selection([
+ ('E', 'Exempt from tax'),
+ ('G', 'Free export item, tax not charged'),
+ ('O', 'Services outside scope of tax'),
+ ('S', 'Standard rate'),
+ ('Z', 'Zero rated goods')], 'EDI UNECE code',
+ help="Follow the UN/ECE 5305 standard from the United Nations Economic Commission for Europe for more "
+ "information http://www.unece.org/trade/untdid/d08a/tred/tred5305.htm"
+ )
+
+ def _get_tax_vals(self, company, tax_template_to_tax):
+ val = super()._get_tax_vals(company, tax_template_to_tax)
+ val.update({
+ 'l10n_pe_edi_tax_code': self.l10n_pe_edi_tax_code,
+ 'l10n_pe_edi_unece_category': self.l10n_pe_edi_unece_category,
+ })
+ return val
diff --git a/addons/l10n_pe/models/l10n_latam_identification_type.py b/addons/l10n_pe/models/l10n_latam_identification_type.py
new file mode 100644
index 00000000..447ef046
--- /dev/null
+++ b/addons/l10n_pe/models/l10n_latam_identification_type.py
@@ -0,0 +1,9 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import models, fields
+
+
+class L10nLatamIdentificationType(models.Model):
+
+ _inherit = "l10n_latam.identification.type"
+
+ l10n_pe_vat_code = fields.Char()
diff --git a/addons/l10n_pe/models/res_city.py b/addons/l10n_pe/models/res_city.py
new file mode 100644
index 00000000..c9e653ae
--- /dev/null
+++ b/addons/l10n_pe/models/res_city.py
@@ -0,0 +1,9 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import fields, models
+
+
+class City(models.Model):
+ _inherit = "res.city"
+
+ l10n_pe_code = fields.Char('Code', help='This code will help with the '
+ 'identification of each city in Peru.')
diff --git a/addons/l10n_pe/models/res_city_district.py b/addons/l10n_pe/models/res_city_district.py
new file mode 100644
index 00000000..52ae38c0
--- /dev/null
+++ b/addons/l10n_pe/models/res_city_district.py
@@ -0,0 +1,14 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import fields, models
+
+
+class L10nPeResCityDistrict(models.Model):
+ _name = 'l10n_pe.res.city.district'
+ _description = 'District'
+ _order = 'name'
+
+ name = fields.Char(translate=True)
+ city_id = fields.Many2one('res.city', 'City')
+ code = fields.Char(
+ help='This code will help with the identification of each district '
+ 'in Peru.')
diff --git a/addons/l10n_pe/models/res_partner.py b/addons/l10n_pe/models/res_partner.py
new file mode 100644
index 00000000..a17e1a70
--- /dev/null
+++ b/addons/l10n_pe/models/res_partner.py
@@ -0,0 +1,10 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details
+from odoo import fields, models
+
+
+class ResPartner(models.Model):
+ _inherit = 'res.partner'
+
+ l10n_pe_district = fields.Many2one(
+ 'l10n_pe.res.city.district', string='District',
+ help='Districts are part of a province or city.') \ No newline at end of file