Initial commit: L10N_Americas packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 12b27ce151
714 changed files with 79328 additions and 0 deletions

View file

@ -0,0 +1 @@
from . import account_demo

View file

@ -0,0 +1,150 @@
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from odoo import api, Command, models
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
@api.model
def _get_demo_data_move(self):
cid = self.env.company.id
def _get_tax_by_code(code, type_tax='sale'):
taxes = self.env['account.tax'].search([
('company_id', '=', cid), ('type_tax_use', '=', type_tax), ('l10n_pe_edi_tax_code', '=', code)], limit=1)
return [Command.set(taxes.ids)]
model, data = super()._get_demo_data_move()
ref = self.env.ref
last_month_date = datetime.strptime(data[f'{cid}_demo_invoice_1']['invoice_date'], '%Y-%m-%d') - timedelta(days=1)
if self.env.company.account_fiscal_country_id.code == "PE":
data[f'{cid}_demo_invoice_1']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_1']['l10n_latam_document_number'] = 'FFF-0000001'
data[f'{cid}_demo_invoice_1']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 25000.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('9997')}),
]
data[f'{cid}_demo_invoice_2']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_2']['l10n_latam_document_number'] = 'FFF-0000002'
data[f'{cid}_demo_invoice_2']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 12500.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('1000')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 1000.0, 'tax_ids': _get_tax_by_code('9997')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 1500.0, 'tax_ids': _get_tax_by_code('9998')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 12500.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('1000')}),
]
data[f'{cid}_demo_invoice_3']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_3']['l10n_latam_document_type_id'] = ref('l10n_pe.document_type08').id,
data[f'{cid}_demo_invoice_3']['l10n_latam_document_number'] = 'NDI-0000001'
data[f'{cid}_demo_invoice_3']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 12500.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('1000')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 1000.0, 'tax_ids': _get_tax_by_code('9997')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 1500.0, 'tax_ids': _get_tax_by_code('9998')}),
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 12500.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('1000')}),
]
data[f'{cid}_demo_invoice_followup']['move_type'] = 'in_invoice'
data[f'{cid}_demo_invoice_followup']['partner_id'] = ref('base.res_partner_2').id
data[f'{cid}_demo_invoice_followup']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_followup']['l10n_latam_document_number'] = 'FFF-100001'
data[f'{cid}_demo_invoice_followup']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 500.0}),
]
data[f'{cid}_demo_invoice_5']['partner_id'] = ref('base.res_partner_2').id
data[f'{cid}_demo_invoice_5']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_5']['l10n_latam_document_number'] = 'FFF-100002'
data[f'{cid}_demo_invoice_5']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 500.0, 'tax_ids': _get_tax_by_code('1000', 'purchase')}),
]
igv_gyng_tax = self.env['account.tax'].search([('company_id', '=', cid), ('type_tax_use', '=', 'purchase'), ('tax_group_id.name', '=', 'IGV GyNG')], limit=1)
data[f'{cid}_demo_invoice_equipment_purchase']['partner_id'] = ref('base.res_partner_2').id
data[f'{cid}_demo_invoice_equipment_purchase']['invoice_date'] = last_month_date
data[f'{cid}_demo_invoice_equipment_purchase']['l10n_latam_document_number'] = 'FFF-100003'
data[f'{cid}_demo_invoice_equipment_purchase']['invoice_line_ids'] = [
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 500.0, 'quantity': 1, 'tax_ids': [Command.set(igv_gyng_tax.ids)]}),
]
data[f'{cid}_demo_invoice_6'] = {
'move_type': 'in_invoice',
'partner_id': ref('base.res_partner_2').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'FFF-100004',
'invoice_line_ids': [
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 500.0, 'quantity': 1, 'tax_ids': _get_tax_by_code('9997', 'purchase')}),
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 1000.0, 'quantity': 1, 'tax_ids': _get_tax_by_code('1000', 'purchase')}),
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 1500.0, 'quantity': 2, 'tax_ids': _get_tax_by_code('9996', 'purchase')}),
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 2000.0, 'quantity': 1, 'tax_ids': _get_tax_by_code('9998', 'purchase')}),
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 2500.0, 'quantity': 1, 'tax_ids': _get_tax_by_code('1000', 'purchase')}),
],
}
data[f'{cid}_demo_invoice_7'] = {
'move_type': 'in_invoice',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'FFF-000005',
'l10n_latam_document_type_id': ref('l10n_pe.document_type91').id,
'invoice_line_ids': [
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 25000.0, 'quantity': 3, 'tax_ids': _get_tax_by_code('9995', 'purchase')}),
],
}
data[f'{cid}_demo_invoice_8'] = {
'move_type': 'in_invoice',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': '118-145266',
'l10n_latam_document_type_id': ref('l10n_pe.document_type50').id,
'invoice_line_ids': [
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 3, 'quantity': 25000.0, 'tax_ids': _get_tax_by_code('9995', 'purchase')}),
],
}
data[f'{cid}_demo_invoice_9'] = {
'move_type': 'in_invoice',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'FFF-100009',
'l10n_latam_document_type_id': ref('l10n_pe.document_type91').id,
'invoice_line_ids': [
Command.create({'product_id': ref('product.product_delivery_01').id, 'price_unit': 3, 'quantity': 25000.0, 'tax_ids': _get_tax_by_code('9995', 'purchase')}),
],
}
data[f'{cid}_demo_invoice_10'] = {
'move_type': 'out_refund',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'CNE-0000001',
'invoice_line_ids': [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 25000.0, 'price_unit': 3.0, 'tax_ids': _get_tax_by_code('9997')}),
],
}
data[f'{cid}_demo_invoice_11'] = {
'move_type': 'in_refund',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'FFF-100005',
'invoice_line_ids': [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 500.0}),
],
}
data[f'{cid}_demo_invoice_12'] = {
'move_type': 'in_invoice',
'partner_id': ref('base.res_partner_12').id,
'invoice_user_id': ref('base.user_demo').id,
'l10n_latam_document_type_id': ref('l10n_pe.document_type08').id,
'invoice_payment_term_id': ref('account.account_payment_term_end_following_month').id,
'invoice_date': last_month_date,
'l10n_latam_document_number': 'FFF-100006',
'invoice_line_ids': [
Command.create({'product_id': ref('product.consu_delivery_03').id, 'quantity': 1.0, 'price_unit': 500.0}),
],
}
return model, data

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="partner_demo_company_pe" model="res.partner">
<field name="name">PE Company</field>
<field name="vat">10071037199</field>
<field name="street">Calle Las Tortugas</field>
<field name="city">Chorrillos</field>
<field name="country_id" ref="base.pe"/>
<field name="state_id" ref="base.state_pe_25"/>
<field name="zip">15067</field>
<field name="phone">+51 912 345 678</field>
<field name="email">info@company.peexample.com</field>
<field name="website">www.peexample.com</field>
<field name="l10n_latam_identification_type_id" ref="it_RUC"/>
</record>
<record id="demo_company_pe" model="res.company">
<field name="name">PE Company</field>
<field name="partner_id" ref="partner_demo_company_pe"/>
</record>
<function model="res.company" name="_onchange_country_id">
<value eval="[ref('demo_company_pe')]"/>
</function>
<function model="res.users" name="write">
<value eval="[ref('base.user_root'), ref('base.user_admin'), ref('base.user_demo')]"/>
<value eval="{'company_ids': [(4, ref('l10n_pe.demo_company_pe'))]}"/>
</function>
<function model="account.chart.template" name="try_loading">
<value eval="[ref('l10n_pe.pe_chart_template')]"/>
<value model="res.company" eval="obj().env.ref('l10n_pe.demo_company_pe')"/>
</function>
</odoo>

View file

@ -0,0 +1,11 @@
<odoo>
<record id="l10n_pe_partner_1" model="res.partner">
<field name="name">Comercial Constructora los Patitos S.A.</field>
<field name="country_id" ref="base.pe"/>
<field name="vat">20121888549</field>
<field name="company_type">company</field>
<field name="zip">150101</field>
<field name="street2">Av. Pedro de Osma Nro. 434</field>
<field name="l10n_latam_identification_type_id" ref="it_RUC"/>
</record>
</odoo>