summaryrefslogtreecommitdiff
path: root/addons/l10n_pe/models
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-13 18:07:59 +0200
committerChristophe Simonis <chs@odoo.com>2019-09-13 18:07:59 +0200
commit6c948c36bbf72dd896e0bff03aa7fbddadcbb0cd (patch)
treef8620905c011735d8a3c340c46d1417a54a75972 /addons/l10n_pe/models
parent48503fcf08eac6fed12e080d4f501f9bbc8d257d (diff)
parent197474e5b9ad43ab2d587a98136a1a809ce9a2e7 (diff)
[MERGE] forward port branch saas-12.5 up to 197474e5b9a
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.py60
-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, 117 insertions, 0 deletions
diff --git a/addons/l10n_pe/models/__init__.py b/addons/l10n_pe/models/__init__.py
new file mode 100644
index 00000000000..7be3012e1aa
--- /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 00000000000..4c0062fdb6f
--- /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 00000000000..eb8674c629c
--- /dev/null
+++ b/addons/l10n_pe/models/account_tax.py
@@ -0,0 +1,60 @@
+# 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'),
+ ('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'),
+ ('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 \ No newline at end of file
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 00000000000..447ef046cde
--- /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 00000000000..c9e653ae81b
--- /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 00000000000..52ae38c012d
--- /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 00000000000..a17e1a7008b
--- /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