diff --git a/addons/l10n_cl/data/account_fiscal_template.xml b/addons/l10n_cl/data/account_fiscal_template.xml index 2b6f358a3ce..06bf25d667e 100644 --- a/addons/l10n_cl/data/account_fiscal_template.xml +++ b/addons/l10n_cl/data/account_fiscal_template.xml @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -39,8 +39,18 @@ - + + + + + + + + + + + Compras - Otros @@ -49,7 +59,7 @@ - + @@ -61,6 +71,16 @@ + + + + + + + + + + Compras - Exentas @@ -76,6 +96,26 @@ + + Compras - Supermercado + + + + + + + + + + + + + + + + + + Ventas - Exentas diff --git a/addons/l10n_cl/data/account_tax_data.xml b/addons/l10n_cl/data/account_tax_data.xml index 22e2a4b2d42..13c7ece44c2 100644 --- a/addons/l10n_cl/data/account_tax_data.xml +++ b/addons/l10n_cl/data/account_tax_data.xml @@ -1,11 +1,12 @@ - + + IVA 19% Venta - IVA 19% Venta + IVA 19% Vta 19 percent sale @@ -42,7 +43,7 @@ IVA 19% Compra - IVA 19% Compra + IVA 19% Comp 19 percent purchase @@ -78,8 +79,8 @@ - Retención de Segunda Categoría - Retención de Segunda Categoría + Ret. 2da Categoría + Ret. 2da Cat -10.75 percent @@ -117,7 +118,7 @@ Específico Compra - Especifico + Espec. Comp 63 percent purchase @@ -150,7 +151,7 @@ - IVA Compra - 19% Activo Fijo + IVA Compra 19% Activo Fijo IVA 19% ActF 19 percent @@ -175,12 +176,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_compras_activo_fijo')], + 'minus_report_line_ids': [ref('tax_report_compras_activo_fijo')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_compras_iva_activo_fijo')], + 'minus_report_line_ids': [ref('tax_report_compras_iva_activo_fijo')], 'account_id': ref('account_110730'), }), ]"/> @@ -188,7 +189,7 @@ - IVA Compra - 19% Activo Fijo Uso Común + IVA Compra 19% Act. Fijo Uso Común IVA 19% ActFUC 19 percent @@ -213,12 +214,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_compras_activo_fijo_uso_comun')], + 'minus_report_line_ids': [ref('tax_report_compras_activo_fijo_uso_comun')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_compras_iva_activo_fijo_uso_comun')], + 'minus_report_line_ids': [ref('tax_report_compras_iva_activo_fijo_uso_comun')], 'account_id': ref('account_110730'), }), ]"/> @@ -226,7 +227,7 @@ - IVA Compra - 19% Activo Fijo No Recuperable + IVA Compra 19% Activo Fijo No Recup IVA 19% ActFNR 19 percent @@ -244,27 +245,27 @@ 'factor_percent': 100, 'repartition_type': 'tax', 'plus_report_line_ids': [ref('tax_report_compras_iva_activo_fijo_no_recup')], - 'account_id': ref('account_110730'), + 'account_id': ref('account_420220'), }), ]"/> - Beb. Analcólicas 10% (Compras) + Beb. Analc. 10% (Compras) ILA C 10% 10 percent @@ -289,12 +290,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_base_ila_compras')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_compras')], 'account_id': ref('account_420220'), }), ]"/> @@ -302,7 +303,7 @@ - Beb. Analcólicas 18% (Compras) + Beb. Analc 18% (Compras) ILA C 18% 18 percent @@ -327,12 +328,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_base_ila_compras')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_compras')], 'account_id': ref('account_420220'), }), ]"/> @@ -365,12 +366,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_base_ila_compras')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_compras')], 'account_id': ref('account_420220'), }), ]"/> @@ -403,12 +404,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_base_ila_compras')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_compras')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_compras')], 'account_id': ref('account_420220'), }), ]"/> @@ -416,7 +417,7 @@ - Beb. Analcólicas 10% (Ventas) + Beb. Analc. 10% (Ventas) ILA V 10% 10 percent @@ -441,12 +442,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_base_ila_ventas')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_ventas')], 'account_id': ref('account_210760'), }), ]"/> @@ -454,7 +455,7 @@ - Beb. Analcólicas 18% (Ventas) + Beb. Analc 18% (Ventas) ILA V 18% 18 percent @@ -479,12 +480,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_base_ila_ventas')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_ventas')], 'account_id': ref('account_210760'), }), ]"/> @@ -517,12 +518,12 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_base_ila_ventas')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_ventas')], 'account_id': ref('account_210760'), }), ]"/> @@ -555,15 +556,129 @@ (0,0, { 'factor_percent': 100, 'repartition_type': 'base', - 'plus_report_line_ids': [ref('tax_report_base_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_base_ila_ventas')], }), (0,0, { 'factor_percent': 100, 'repartition_type': 'tax', - 'plus_report_line_ids': [ref('tax_report_tax_ila_ventas')], + 'minus_report_line_ids': [ref('tax_report_tax_ila_ventas')], 'account_id': ref('account_210760'), }), ]"/> + + + IVA Compra 19% No Recup. + IVA 19% NoR + 19 + percent + purchase + 14 + + + + + + + + + IVA Compra 19% Uso Común + IVA 19% CUC + 19 + percent + purchase + 14 + + + + + + + + + IVA Compra 19% Superm. + IVA 19% SupMRec + 19 + percent + purchase + 14 + + + + + + diff --git a/addons/l10n_cl/data/l10n_cl_chart_data.xml b/addons/l10n_cl/data/l10n_cl_chart_data.xml index cbeba3f8bdb..b602685bdb1 100644 --- a/addons/l10n_cl/data/l10n_cl_chart_data.xml +++ b/addons/l10n_cl/data/l10n_cl_chart_data.xml @@ -348,7 +348,7 @@ 110640 Existencias en Tránsito - + @@ -786,7 +786,7 @@ 210230 Facturas por Recibir - + @@ -1547,8 +1547,7 @@ + eval="[(6,0,[ref('tag_cl_purchase_mnt_neto_uso_comun')])]"/> 410232 @@ -1575,6 +1574,8 @@ + @@ -1667,12 +1668,14 @@ - + - + + + diff --git a/addons/l10n_cl/data/l10n_latam.document.type.csv b/addons/l10n_cl/data/l10n_latam.document.type.csv index 3fdd90b6b30..97119bd79e8 100644 --- a/addons/l10n_cl/data/l10n_latam.document.type.csv +++ b/addons/l10n_cl/data/l10n_latam.document.type.csv @@ -1,11 +1,11 @@ id,sequence,code,name,report_name,internal_type,doc_code_prefix,country_id/id,active -dc_b_f_dte,1,39,Boleta Electrónica,BEL,invoice,BEL,base.cl,True -dc_a_f_dte,2,33,Factura Electrónica,FACTURA,invoice,FAC,base.cl,True -dc_y_f_dte,3,34,Factura no Afecta o Exenta Electrónica,F-EXENTA,invoice,FNA,base.cl,True -dc_m_d_dtn,4,71,Boleta de Honorarios Electrónica,BHE,invoice,BHE,base.cl,True -dc_b_e_dtn,5,38,Boleta exenta,BEX,invoice,BEX,base.cl,False -dc_nc_f_dte,6,61,Nota de Crédito Electrónica,NOTA DE CREDITO,credit_note,N/C,base.cl,True -dc_nd_f_dte,7,56,Nota de Débito Electrónica,NOTA DE DEBITO,debit_note,N/D,base.cl,True +dc_a_f_dte,1,33,Factura Electrónica,FACTURA,invoice,FAC,base.cl,True +dc_y_f_dte,2,34,Factura no Afecta o Exenta Electrónica,F-EXENTA,invoice,FNA,base.cl,True +dc_nc_f_dte,3,61,Nota de Crédito Electrónica,NOTA DE CREDITO,credit_note,N/C,base.cl,True +dc_nd_f_dte,4,56,Nota de Débito Electrónica,NOTA DE DEBITO,debit_note,N/D,base.cl,True +dc_b_f_dte,5,39,Boleta Electrónica,BEL,invoice,BEL,base.cl,True +dc_m_d_dtn,6,71,Boleta de Honorarios Electrónica,BHE,invoice,BHE,base.cl,True +dc_b_e_dtn,7,38,Boleta exenta,BEX,invoice,BEX,base.cl,False dc_I_f_dtn,10,29,Factura de Inicio,FAI,invoice,FAI,base.cl,False dc_a_f_dtn,10,30,Factura,FACTURA,invoice,FAC,base.cl,False dc_y_f_dtn,10,32,Factura de Ventas y Servicios no Afectos o Exentos de IVA,F-EXENTA,invoice,FNA,base.cl,False @@ -35,6 +35,7 @@ dc_li,10,103,Liquidación,LIQ,,LIQ,base.cl,False dc_fe_dte,10,110,Factura de Exportación Electrónica,FCXE,invoice,FCXE,base.cl,False dc_ndex_dte,10,111,Nota de Débito de Exportación Electrónica,NDXE,debit_note,NDXE,base.cl,False dc_ncex_dte,10,112,Nota de Crédito de Exportación Electrónica,NCXE,credit_note,NCXE,base.cl,False +dc_odc,10,801,Orden de Compra,OC,,OC,base.cl,False dc_ndp,10,802,Nota de pedido,NP,,NP,base.cl,False dc_cont,10,803,Contrato,CONT,,CONT,base.cl,False dc_resol,10,804,Resolución,RES,,RES,base.cl,False diff --git a/addons/l10n_cl/data/res_partner.xml b/addons/l10n_cl/data/res_partner.xml index c82f074e1d8..0303c65320c 100644 --- a/addons/l10n_cl/data/res_partner.xml +++ b/addons/l10n_cl/data/res_partner.xml @@ -7,6 +7,7 @@ 3 66666666-6 + @@ -16,6 +17,7 @@ 60805000-0 + @@ -25,6 +27,7 @@ 60803000-K + diff --git a/addons/l10n_cl/i18n/es.po b/addons/l10n_cl/i18n/es.po index a8a8400323b..80c15bba2b4 100644 --- a/addons/l10n_cl/i18n/es.po +++ b/addons/l10n_cl/i18n/es.po @@ -4,16 +4,18 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0alpha1+e\n" +"Project-Id-Version: Odoo Server 13.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-08-11 18:27+0000\n" -"PO-Revision-Date: 2019-08-11 18:27+0000\n" +"POT-Creation-Date: 2020-06-08 00:58+0000\n" +"PO-Revision-Date: 2020-06-07 21:07-0400\n" "Last-Translator: \n" "Language-Team: \n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" +"X-Generator: Poedit 2.3.1\n" #. module: l10n_cl #: model:ir.model.fields,help:l10n_cl.field_res_partner__l10n_cl_sii_taxpayer_type @@ -29,6 +31,11 @@ msgstr "" "3 - Consumidor Final (se le emitirán siempre boletas)\n" "4 - Extranjero" +#. module: l10n_cl +#: model:ir.model,name:l10n_cl.model_account_chart_template +msgid "Account Chart Template" +msgstr "Plantilla de Plan de Cuentas" + #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Accounting Date" @@ -38,7 +45,7 @@ msgstr "Fecha contable" #: model:product.product,name:l10n_cl.product_product_ad_valorem #: model:product.template,name:l10n_cl.product_product_ad_valorem_product_template msgid "Ad-Valorem" -msgstr "" +msgstr "Ad-Valorem" #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree @@ -48,15 +55,15 @@ msgstr "Monto adeudado" #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Amount Untaxed" -msgstr "Mon sin impuestos" +msgstr "Monto sin impuestos" #. module: l10n_cl #: model:ir.model.fields,help:l10n_cl.field_account_move__l10n_latam_internal_type #: model:ir.model.fields,help:l10n_cl.field_l10n_latam_document_type__internal_type msgid "" "Analog to odoo account.move.type but with more options allowing to identify " -"the kind of document we are working with. (not only related to account.move," -" could be for documents of other models like stock.picking)" +"the kind of document we are working with. (not only related to account.move, " +"could be for documents of other models like stock.picking)" msgstr "" "Análogo a account.move.type de Odoo pero con más opciones, permitiendo " "identificar el tipo de documento sobre el que estamos trabajando. (no " @@ -66,7 +73,7 @@ msgstr "" #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_bar msgid "BAR" -msgstr "" +msgstr "BAR" #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_res_bank @@ -76,12 +83,7 @@ msgstr "Banco" #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_carton msgid "CARTON" -msgstr "" - -#. module: l10n_cl -#: model:l10n_latam.identification.type,name:l10n_cl.it_CIe -msgid "CIe" -msgstr "" +msgstr "CARTON" #. module: l10n_cl #: model:product.product,description:l10n_cl.product_product_ad_valorem @@ -94,6 +96,11 @@ msgstr "" msgid "Chile" msgstr "" +#. module: l10n_cl +#: model_terms:ir.ui.view,arch_db:l10n_cl.res_config_settings_view_form +msgid "Chilean Localization" +msgstr "Localización Chilena" + #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_res_bank__l10n_cl_sbif_code msgid "Cod. SBIF" @@ -109,6 +116,11 @@ msgstr "Código usado por diferentes localizaciones" msgid "Companies" msgstr "Compañías" +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__3 +msgid "Consumidor final" +msgstr "" + #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_res_partner msgid "Contact" @@ -116,20 +128,18 @@ msgstr "Contacto" #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_res_country -#: model:ir.model.fields,field_description:l10n_cl.field_res_partner__country_id -#: model:ir.model.fields,field_description:l10n_cl.field_res_users__country_id msgid "Country" msgstr "País" #. module: l10n_cl -#: selection:l10n_latam.document.type,internal_type:0 -msgid "Credit Notes" -msgstr "Notas de crédito" +#: model_terms:ir.ui.view,arch_db:l10n_cl.view_account_journal_form_inherit_l10n_cl +msgid "Create New Sequences" +msgstr "Crear nuevas secuencias" #. module: l10n_cl -#: model:account.account.type,name:l10n_cl.account_account_type_NCLASIFICADO -msgid "Cuentas No Clasificadas" -msgstr "" +#: model:ir.model.fields.selection,name:l10n_cl.selection__l10n_latam_document_type__internal_type__credit_note +msgid "Credit Notes" +msgstr "Notas de Crédito" #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_res_currency @@ -141,13 +151,17 @@ msgstr "Moneda" msgid "Currency Code" msgstr "Código de moneda" +#. module: l10n_cl +#: model:ir.model.fields,field_description:l10n_cl.field_res_country__l10n_cl_customs_abbreviation +msgid "Customs Abbreviation" +msgstr "Abreviatura de aduana" + #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_res_country__l10n_cl_customs_code msgid "Customs Code" msgstr "Código de aduana" #. module: l10n_cl -#: model:ir.model.fields,field_description:l10n_cl.field_res_country__l10n_cl_customs_abbreviation #: model:ir.model.fields,field_description:l10n_cl.field_res_country__l10n_cl_customs_name msgid "Customs Name" msgstr "Nombre de aduana" @@ -163,9 +177,9 @@ msgid "Datos adic. dirección y Ciudad" msgstr "" #. module: l10n_cl -#: selection:l10n_latam.document.type,internal_type:0 +#: model:ir.model.fields.selection,name:l10n_cl.selection__l10n_latam_document_type__internal_type__debit_note msgid "Debit Notes" -msgstr "Notas de débito" +msgstr "Notas de Débito" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_account_move__l10n_latam_document_type_id_code @@ -173,8 +187,22 @@ msgid "Doc Type" msgstr "Tipo documento" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:18 -#: selection:res.partner,l10n_cl_sii_taxpayer_type:0 +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"Document types for foreign customers must be export type (codes 110, 111 or " +"112)" +msgstr "" +"Los tipos de documento para clientes extranjeros deben ser de exportación. " +"(Códigos 110, 111 o 112)" + +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__2 +msgid "Emisor de boleta 2da categoría" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/res_partner.py:0 #, python-format msgid "End Consumer" msgstr "Consumidor final" @@ -185,8 +213,12 @@ msgid "Energía" msgstr "" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:17 -#: selection:res.partner,l10n_cl_sii_taxpayer_type:0 +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__4 +msgid "Extranjero" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/res_partner.py:0 #, python-format msgid "Fees Receipt Issuer (2nd category)" msgstr "Emisor de boleta 2da categoría" @@ -194,11 +226,10 @@ msgstr "Emisor de boleta 2da categoría" #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Folio" -msgstr "" +msgstr "Folio" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:19 -#: selection:res.partner,l10n_cl_sii_taxpayer_type:0 +#: code:addons/l10n_cl/models/res_partner.py:0 #, python-format msgid "Foreigner" msgstr "Extranjero" @@ -218,29 +249,40 @@ msgstr "" msgid "IVA 19%" msgstr "" +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__1 +#, fuzzy +#| msgid "VAT Affected (1st Category)" +msgid "IVA afecto 1ª categoría" +msgstr "IVA afecto 1ª categoría" + #. module: l10n_cl #: model:ir.model.fields,help:l10n_cl.field_account_move__partner_id_vat -msgid "Identification Number for selected type." -msgstr "Número de identificación" +msgid "Identification Number for selected type" +msgstr "Número de Id para el tipo seleccionado" #. module: l10n_cl #: model:account.tax.group,name:l10n_cl.tax_group_impuestos_especificos msgid "Impuestos Específicos" msgstr "" +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"In Chilean localization, you need to use documents in the sales journalin " +"order to register your sales properly" +msgstr "" +"Para la localización chilena es necesario usar documentos en los diarios de " +"venta para registrar adecuadamente sus ventas" + #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_l10n_latam_document_type__internal_type msgid "Internal Type" msgstr "Tipo interno" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:78 -#, python-format -msgid "Invalid length." -msgstr "Longitud inválida" - -#. module: l10n_cl -#: selection:l10n_latam.document.type,internal_type:0 +#: model:ir.model.fields.selection,name:l10n_cl.selection__l10n_latam_document_type__internal_type__invoice msgid "Invoices" msgstr "Facturas" @@ -259,6 +301,11 @@ msgstr "Diario" msgid "Journal Entries" msgstr "Asientos contables" +#. module: l10n_cl +#: model:ir.model.fields,field_description:l10n_cl.field_ir_sequence__l10n_cl_journal_ids +msgid "Journals" +msgstr "Diarios" + #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_knfc msgid "KNFC" @@ -272,12 +319,12 @@ msgstr "" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_account_move__l10n_latam_internal_type msgid "L10n Latam Internal Type" -msgstr "" +msgstr "L10n Tipo Interno (Latam)" #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_l10n_latam_document_type msgid "Latam Document Type" -msgstr "" +msgstr "Tipo de Documento Latam" #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_mm @@ -304,18 +351,6 @@ msgstr "" msgid "Next Number" msgstr "Próximo número" -#. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:109 -#, python-format -msgid "No RUT configured for partner [%i] %s" -msgstr "No se configuró RUT para el cliente o proveedor [%i] %" - -#. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:80 -#, python-format -msgid "Only numbers allowed." -msgstr "Solo se permite números" - #. module: l10n_cl #: model:uom.category,name:l10n_cl.uom_categ_others msgid "Otros" @@ -326,20 +361,15 @@ msgstr "" msgid "PAR" msgstr "" -#. module: l10n_cl -#: model:l10n_latam.identification.type,name:l10n_cl.it_PAS -msgid "PAS" -msgstr "" - #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_uom_uom msgid "Product Unit of Measure" -msgstr "Unidad de medida" +msgstr "Unidad de medida del producto" #. module: l10n_cl -#: selection:l10n_latam.document.type,internal_type:0 +#: model:ir.model.fields.selection,name:l10n_cl.selection__l10n_latam_document_type__internal_type__invoice_in msgid "Purchase Invoices" -msgstr "Órdenes de compra" +msgstr "Facturas de proveedores" #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_qmb @@ -359,10 +389,10 @@ msgstr "" #. module: l10n_cl #: model:l10n_latam.identification.type,name:l10n_cl.it_RUT msgid "RUT" -msgstr "" +msgstr "RUT" #. module: l10n_cl -#: selection:l10n_latam.document.type,internal_type:0 +#: model:ir.model.fields.selection,name:l10n_cl.selection__l10n_latam_document_type__internal_type__receipt_invoice msgid "Receipt Invoice" msgstr "" @@ -388,15 +418,21 @@ msgid "S.U.M" msgstr "" #. module: l10n_cl +#: model:ir.model.fields,field_description:l10n_cl.field_account_tax__l10n_cl_sii_code +#: model:ir.model.fields,field_description:l10n_cl.field_account_tax_template__l10n_cl_sii_code #: model:ir.model.fields,field_description:l10n_cl.field_uom_uom__l10n_cl_sii_code msgid "SII Code" -msgstr "" +msgstr "Código SII" #. module: l10n_cl #: model:ir.actions.act_window,name:l10n_cl.sale_invoices_credit_notes +msgid "Sale Invoices and Credit Notes" +msgstr "Facturas de Venta y Notas de Crédito" + +#. module: l10n_cl #: model:ir.ui.menu,name:l10n_cl.menu_sale_invoices_credit_notes -msgid "(CL) Sale Invoices and Credit Notes" -msgstr "(CL) Facturas de venta y notas de crédito" +msgid "Sale Invoices and Credit Notes (CL)" +msgstr "Facturas de Vta y Notas de Crédito (CL)" #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree @@ -404,14 +440,15 @@ msgid "Sales Person" msgstr "Comercial" #. module: l10n_cl +#: model:ir.model,name:l10n_cl.model_ir_sequence #: model_terms:ir.ui.view,arch_db:l10n_cl.view_account_journal_form_inherit_l10n_cl msgid "Sequence" msgstr "Secuencia" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_account_journal__l10n_cl_sequence_ids -msgid "Sequences" -msgstr "Secuencias" +msgid "Sequences (cl)" +msgstr "Secuencias (CL)" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_res_currency__l10n_cl_short_name @@ -434,26 +471,102 @@ msgid "TMN" msgstr "" #. module: l10n_cl +#: model:ir.model,name:l10n_cl.model_account_tax #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Tax" +msgstr "Impuesto" + +#. module: l10n_cl +#: model_terms:ir.ui.view,arch_db:l10n_cl.view_move_form +msgid "Tax Payer Type" +msgstr "Tipo de Contribuyente" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"Tax payer type and vat number are mandatory for this type of document. " +"Please set the current tax payer type of this customer" msgstr "" +"El tipo de contribuyente y el número de RUT son requeridos para este tipo de " +"documento. Por favor establezca un valor para el tipo de contribuyente de " +"este Cliente" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"Tax payer type and vat number are mandatory for this type of document. " +"Please set the current tax payer type of this supplier" +msgstr "" +"El tipo de contribuyente y el número de RUT son requeridos para este tipo de " +"documento. Por favor establezca un valor para el tipo de contribuyente de " +"este Proveedor" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_res_partner__l10n_cl_sii_taxpayer_type #: model:ir.model.fields,field_description:l10n_cl.field_res_users__l10n_cl_sii_taxpayer_type -msgid "Taxpayer Types" -msgstr "" +msgid "Taxpayer Type" +msgstr "Tipo de Contribuyente" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:76 +#: model:ir.model,name:l10n_cl.model_account_tax_template +msgid "Templates for Taxes" +msgstr "Plantilla de impuestos" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 #, python-format -msgid "The validation digit is not valid." -msgstr "El dígito de validación no es correcto" +msgid "" +"The DIN document is intended to be used only with RUT 60805000-0 (Tesorería " +"General de La República)" +msgstr "" +"El documento “declaración de ingreso” (DIN) debe ser usado solamente para " +"“Tesorería General de La República” (RUT 60805000-0)" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is incorrect for the selected type of " +"document." +msgstr "" +"El tipo de contribuyente de este proveedor es incorrecto para el tipo de " +"documento seleccionado." + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is not entitled to deliver fees documents" +msgstr "" +"El tipo de contribuyente para este proveedor no puede emitir boletas de " +"honorarios" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is not entitled to deliver imports " +"documents" +msgstr "" +"El tipo de contribuyente para este proveedor no puede emitir documentos de " +"importación" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"This supplier should be defined as foreigner tax payer type and the country " +"should be different from Chile to register purchases." +msgstr "" +"Este proveedor debería ser definido como tipo de contribuyente “Extranjero” " +"y el país debería ser diferente de Chile para registrar compras." #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Total" -msgstr "" +msgstr "Total" #. module: l10n_cl #: model:uom.uom,name:l10n_cl.product_uom_u @@ -461,8 +574,7 @@ msgid "U(JGO)" msgstr "" #. module: l10n_cl -#: code:addons/l10n_cl/models/res_partner.py:16 -#: selection:res.partner,l10n_cl_sii_taxpayer_type:0 +#: code:addons/l10n_cl/models/res_partner.py:0 #, python-format msgid "VAT Affected (1st Category)" msgstr "IVA afecto 1ª categoría" @@ -470,16 +582,22 @@ msgstr "IVA afecto 1ª categoría" #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_account_move__partner_id_vat msgid "VAT No" -msgstr "" +msgstr "RUT Nº" #. module: l10n_cl #: model:ir.actions.act_window,name:l10n_cl.vendor_bills_and_refunds -#: model:ir.ui.menu,name:l10n_cl.menu_vendor_bills_and_refunds -msgid "(CL) Vendor Bills and Refunds" -msgstr "(CL) Facturas y notas de crédito de proveedores" +msgid "Vendor Bills and Refunds" +msgstr "Facturas y Notas de Créd de Proveedores" #. module: l10n_cl -#: code:addons/l10n_cl/models/account_move.py:54 +#: model:ir.ui.menu,name:l10n_cl.menu_vendor_bills_and_refunds +msgid "Vendor Bills and Refunds (CL)" +msgstr "Facturas de Proveedor y Notas de Crédito (CL)" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 #, python-format -msgid "You can not use a %s document type with this tax payer type" -msgstr "No puedes usar un tipo de documento %s con este tipo de contribuyente " +msgid "You need a journal without the use of documents for foreign suppliers" +msgstr "" +"Ud. necesita un diario que no use documentos para registrar facturas de " +"proveedores extranjeros" diff --git a/addons/l10n_cl/i18n/l10n_cl.pot b/addons/l10n_cl/i18n/l10n_cl.pot index 2d101352216..43c90c6079a 100644 --- a/addons/l10n_cl/i18n/l10n_cl.pot +++ b/addons/l10n_cl/i18n/l10n_cl.pot @@ -4,10 +4,10 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 13.0+e\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-01-29 15:06+0000\n" -"PO-Revision-Date: 2020-01-29 15:06+0000\n" +"POT-Creation-Date: 2020-06-08 00:58+0000\n" +"PO-Revision-Date: 2020-06-08 00:58+0000\n" "Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -106,6 +106,11 @@ msgstr "" msgid "Companies" msgstr "" +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__3 +msgid "Consumidor final" +msgstr "" + #. module: l10n_cl #: model:ir.model,name:l10n_cl.model_res_partner msgid "Contact" @@ -171,9 +176,21 @@ msgstr "" msgid "Doc Type" msgstr "" +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"Document types for foreign customers must be export type (codes 110, 111 or " +"112)" +msgstr "" + +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__2 +msgid "Emisor de boleta 2da categoría" +msgstr "" + #. module: l10n_cl #: code:addons/l10n_cl/models/res_partner.py:0 -#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__3 #, python-format msgid "End Consumer" msgstr "" @@ -183,9 +200,13 @@ msgstr "" msgid "Energía" msgstr "" +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__4 +msgid "Extranjero" +msgstr "" + #. module: l10n_cl #: code:addons/l10n_cl/models/res_partner.py:0 -#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__2 #, python-format msgid "Fees Receipt Issuer (2nd category)" msgstr "" @@ -197,7 +218,6 @@ msgstr "" #. module: l10n_cl #: code:addons/l10n_cl/models/res_partner.py:0 -#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__4 #, python-format msgid "Foreigner" msgstr "" @@ -217,6 +237,11 @@ msgstr "" msgid "IVA 19%" msgstr "" +#. module: l10n_cl +#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__1 +msgid "IVA afecto 1ª categoría" +msgstr "" + #. module: l10n_cl #: model:ir.model.fields,help:l10n_cl.field_account_move__partner_id_vat msgid "Identification Number for selected type" @@ -227,6 +252,14 @@ msgstr "" msgid "Impuestos Específicos" msgstr "" +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"In Chilean localization, you need to use documents in the sales journalin " +"order to register your sales properly" +msgstr "" + #. module: l10n_cl #: model:ir.model.fields,field_description:l10n_cl.field_l10n_latam_document_type__internal_type msgid "Internal Type" @@ -436,8 +469,16 @@ msgstr "" #: code:addons/l10n_cl/models/account_move.py:0 #, python-format msgid "" -"Tax payer type is mandatory for this type of document. Please set the " -"current tax payer type of this client" +"Tax payer type and vat number are mandatory for this type of document. " +"Please set the current tax payer type of this customer" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"Tax payer type and vat number are mandatory for this type of document. " +"Please set the current tax payer type of this supplier" msgstr "" #. module: l10n_cl @@ -451,6 +492,46 @@ msgstr "" msgid "Templates for Taxes" msgstr "" +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The DIN document is intended to be used only with RUT 60805000-0 (Tesorería " +"General de La República)" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is incorrect for the selected type of " +"document." +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is not entitled to deliver fees " +"documents" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"The tax payer type of this supplier is not entitled to deliver imports " +"documents" +msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "" +"This supplier should be defined as foreigner tax payer type and the country " +"should be different from Chile to register purchases." +msgstr "" + #. module: l10n_cl #: model_terms:ir.ui.view,arch_db:l10n_cl.view_complete_invoice_refund_tree msgid "Total" @@ -463,7 +544,6 @@ msgstr "" #. module: l10n_cl #: code:addons/l10n_cl/models/res_partner.py:0 -#: model:ir.model.fields.selection,name:l10n_cl.selection__res_partner__l10n_cl_sii_taxpayer_type__1 #, python-format msgid "VAT Affected (1st Category)" msgstr "" @@ -482,3 +562,9 @@ msgstr "" #: model:ir.ui.menu,name:l10n_cl.menu_vendor_bills_and_refunds msgid "Vendor Bills and Refunds (CL)" msgstr "" + +#. module: l10n_cl +#: code:addons/l10n_cl/models/account_move.py:0 +#, python-format +msgid "You need a journal without the use of documents for foreign suppliers" +msgstr "" diff --git a/addons/l10n_cl/models/account_journal.py b/addons/l10n_cl/models/account_journal.py index ce218d0a827..5d3fca43818 100644 --- a/addons/l10n_cl/models/account_journal.py +++ b/addons/l10n_cl/models/account_journal.py @@ -13,7 +13,11 @@ class AccountJournal(models.Model): def button_create_new_sequences(self): self.ensure_one() internal_types = ['invoice', 'debit_note', 'credit_note'] - domain = [('country_id.code', '=', 'CL'), ('internal_type', 'in', internal_types), ('active', '=', True)] + domain = [('country_id.code', '=', 'CL'), ('internal_type', 'in', internal_types)] + if self.company_id.partner_id.l10n_cl_sii_taxpayer_type in ['1', False]: + domain += [('code', 'not in', ['70', '71'])] + elif self.company_id.partner_id.l10n_cl_sii_taxpayer_type == '2': + domain += [('code', 'not in', ['33', '34'])] documents = self.env['l10n_latam.document.type'].search(domain) sequences = self.env['ir.sequence'] for document in documents: diff --git a/addons/l10n_cl/models/account_move.py b/addons/l10n_cl/models/account_move.py index 7adb1a73d26..249e155fca7 100644 --- a/addons/l10n_cl/models/account_move.py +++ b/addons/l10n_cl/models/account_move.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo.exceptions import ValidationError - from odoo import models, fields, api, _ @@ -18,26 +17,80 @@ class AccountMove(models.Model): domain = super()._get_l10n_latam_documents_domain() if (self.journal_id.l10n_latam_use_documents and self.journal_id.company_id.country_id == self.env.ref('base.cl')): - if self.move_type in ['in_invoice', 'in_refund']: - if self.partner_id.l10n_cl_sii_taxpayer_type == '2': - domain += [('code', '=', '71')] - return domain - document_type_ids = self.journal_id.l10n_cl_sequence_ids.mapped('l10n_latam_document_type_id').ids - domain += [('id', 'in', document_type_ids)] - if self.partner_id.l10n_cl_sii_taxpayer_type == '3': - domain += [('code', 'in', ['35', '38', '39', '41', '56', '61'])] + if self.journal_id.type == 'sale': + document_type_ids = self.journal_id.l10n_cl_sequence_ids.mapped('l10n_latam_document_type_id').ids + else: # self.journal_id.type == 'purchase': + partner_domain = [ + ('country_id.code', '=', 'CL'), + ('internal_type', 'in', ['invoice', 'debit_note', 'credit_note', 'invoice_in'])] + if not self.partner_id: + pass + elif self.partner_id.l10n_cl_sii_taxpayer_type == '1' and self.partner_id_vat != '60805000-0': + partner_domain += [('code', 'not in', ['39', '70', '71', '914', '911'])] + elif self.partner_id.l10n_cl_sii_taxpayer_type == '1' and self.partner_id_vat == '60805000-0': + partner_domain += [('code', 'not in', ['39', '70', '71'])] + elif self.partner_id.l10n_cl_sii_taxpayer_type == '2': + partner_domain += [('code', 'in', ['70', '71', '56', '61'])] + elif self.partner_id.l10n_cl_sii_taxpayer_type == '3': + partner_domain += [('code', 'in', ['35', '38', '39', '41', '56', '61'])] + elif not self.partner_id.l10n_cl_sii_taxpayer_type or self.partner_id.country_id != self.env.ref( + 'base.cl') or self.partner_id.l10n_cl_sii_taxpayer_type == '4': + partner_domain += [('code', 'in', [])] + document_type_ids = self.env['l10n_latam.document.type'].search(partner_domain).ids + domain = [('id', 'in', document_type_ids)] return domain - @api.constrains('move_type', 'l10n_latam_document_type_id') - def _check_invoice_type_document_type(self): - super()._check_invoice_type_document_type() - for rec in self.filtered(lambda r: r.company_id.country_id == self.env.ref( - 'base.cl') and r.l10n_latam_document_type_id): + def _check_document_types_post(self): + for rec in self.filtered( + lambda r: r.company_id.country_id == self.env.ref('base.cl') and + r.journal_id.type in ['sale', 'purchase']): tax_payer_type = rec.partner_id.l10n_cl_sii_taxpayer_type + vat = rec.partner_id.vat + country_id = rec.partner_id.country_id latam_document_type_code = rec.l10n_latam_document_type_id.code - if not tax_payer_type and latam_document_type_code not in ['35', '38', '39', '41']: - raise ValidationError(_('Tax payer type is mandatory for this type of document. ' - 'Please set the current tax payer type of this client')) + if (not tax_payer_type or not vat) and (country_id == self.env.ref('base.cl') and latam_document_type_code + and latam_document_type_code not in ['35', '38', '39', '41']): + raise ValidationError(_('Tax payer type and vat number are mandatory for this type of ' + 'document. Please set the current tax payer type of this customer')) + if rec.journal_id.type == 'sale' and rec.journal_id.l10n_latam_use_documents: + if (tax_payer_type == '4' or country_id != self.env.ref('base.cl')) and \ + latam_document_type_code not in ['110', '111', '112']: + raise ValidationError(_( + 'Document types for foreign customers must be export type (codes 110, 111 or 112)')) + if rec.journal_id.type == 'purchase' and rec.journal_id.l10n_latam_use_documents: + if vat != '60805000-0' and latam_document_type_code == '914': + raise ValidationError(_('The DIN document is intended to be used only with RUT 60805000-0' + ' (Tesorería General de La República)')) + if not tax_payer_type or not vat: + if country_id == self.env.ref('base.cl') and latam_document_type_code not in [ + '35', '38', '39', '41']: + raise ValidationError(_('Tax payer type and vat number are mandatory for this type of ' + 'document. Please set the current tax payer type of this supplier')) + if tax_payer_type == '2' and latam_document_type_code not in ['70', '71', '56', '61']: + raise ValidationError(_('The tax payer type of this supplier is incorrect for the selected type' + ' of document.')) + if tax_payer_type in ['1', '3']: + if latam_document_type_code in ['70', '71']: + raise ValidationError(_('The tax payer type of this supplier is not entitled to deliver ' + 'fees documents')) + if latam_document_type_code in ['110', '111', '112']: + raise ValidationError(_('The tax payer type of this supplier is not entitled to deliver ' + 'imports documents')) + if tax_payer_type == '4' or country_id != self.env.ref('base.cl'): + raise ValidationError(_('You need a journal without the use of documents for foreign ' + 'suppliers')) + if rec.journal_id.type == 'purchase' and not rec.journal_id.l10n_latam_use_documents: + if tax_payer_type != '4': + raise ValidationError(_('This supplier should be defined as foreigner tax payer type and ' + 'the country should be different from Chile to register purchases.')) + + @api.onchange('journal_id') + def _onchange_journal(self): + self.l10n_latam_document_type_id = False + + def post(self): + self._check_document_types_post() + super().post() def _l10n_cl_get_formatted_sequence(self, number=0): return "%s %06d" % (self.l10n_latam_document_type_id.doc_code_prefix, number) diff --git a/addons/l10n_cl/models/account_tax.py b/addons/l10n_cl/models/account_tax.py index c1edd934a50..0f102863763 100644 --- a/addons/l10n_cl/models/account_tax.py +++ b/addons/l10n_cl/models/account_tax.py @@ -7,7 +7,7 @@ class AccountTax(models.Model): _name = 'account.tax' _inherit = 'account.tax' - l10n_cl_sii_code = fields.Integer('SII Code') + l10n_cl_sii_code = fields.Integer('SII Code', group_operator=False) class AccountTaxTemplate(models.Model): diff --git a/addons/l10n_cl/models/res_partner.py b/addons/l10n_cl/models/res_partner.py index 608f031ae6c..463051628f9 100644 --- a/addons/l10n_cl/models/res_partner.py +++ b/addons/l10n_cl/models/res_partner.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +import stdnum from odoo import _, api, fields, models from odoo.exceptions import UserError, ValidationError @@ -21,3 +22,34 @@ class ResPartner(models.Model): '2 - Fees Receipt Issuer (Applies to suppliers who issue fees receipt)\n' '3 - End consumer (only receipts)\n' '4 - Foreigner') + + def _format_vat_cl(self, values): + identification_types = [self.env.ref('l10n_latam_base.it_vat').id, self.env.ref('l10n_cl.it_RUT').id, + self.env.ref('l10n_cl.it_RUN').id] + partner_country_is_chile = (values.get('country_id') == self.env.ref('base.cl').id) or ( + values.get('l10n_latam_identification_type_id') and + self.env['l10n_latam.identification.type'].browse( + values.get('l10n_latam_identification_type_id')).country_id == self.env.ref('base.cl')) + if partner_country_is_chile and \ + values.get('l10n_latam_identification_type_id') in identification_types and values.get('vat'): + return stdnum.util.get_cc_module('cl', 'vat').format(values['vat']).replace('.', '').replace( + 'CL', '').upper() + else: + return values['vat'] + + @api.model + def create(self, values): + if values.get('vat'): + values['vat'] = self._format_vat_cl(values) + return super().create(values) + + def write(self, values): + for record in self: + vat_values = { + 'vat': values.get('vat', record.vat), + 'l10n_latam_identification_type_id': values.get( + 'l10n_latam_identification_type_id', record.l10n_latam_identification_type_id.id), + 'country_id': values.get('country_id', record.country_id.id) + } + values['vat'] = self._format_vat_cl(vat_values) + return super().write(values)