OCA / l10n-brazil

Localização brasileira oficial do Odoo.
https://odoo-community.org/psc-teams/brazil-66
GNU Affero General Public License v3.0
247 stars 246 forks source link

[14.0][l10n_br_account_nfe] demo data #2110

Open rvalyi opened 2 years ago

rvalyi commented 2 years ago

Se num novo banco com dados de demo, vc instalar primeiro l10n_br_coa_simple, no hook dele, nao vai instalar os diarios de demo pois o l10n_br_account ainda nao esta instalado: https://github.com/OCA/l10n-brazil/blob/14.0/l10n_br_coa_simple/hooks.py#L28

Porem se depois vc instalar depois o modulo l10n_br_account_nfe ele vai tentar usar um desses diarios de demo do l10n_br_coa_simple e ai vai dar esse erro:

2022-09-03 03:48:35,642 686 INFO db-simple2 odoo.modules.registry: module l10n_br_account: creating or updating database tables 
2022-09-03 03:48:36,011 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/security/ir.model.access.csv 
2022-09-03 03:48:36,456 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/data/account_tax_group.xml 
2022-09-03 03:48:36,574 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/data/account_tax_template.xml 
2022-09-03 03:48:36,826 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/account_tax_view.xml 
2022-09-03 03:48:36,876 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/account_tax_template_view.xml 
2022-09-03 03:48:36,922 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/fiscal_operation_view.xml 
2022-09-03 03:48:37,013 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/fiscal_operation_line_view.xml 
2022-09-03 03:48:37,044 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/account_invoice_view.xml 
2022-09-03 03:48:37,327 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/document_line_view.xml 
2022-09-03 03:48:37,372 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/document_view.xml 
2022-09-03 03:48:37,455 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/fiscal_invoice_view.xml 
2022-09-03 03:48:37,593 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/fiscal_invoice_line_view.xml 
2022-09-03 03:48:37,644 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/l10n_br_account_action.xml 
2022-09-03 03:48:37,751 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/views/l10n_br_account_menu.xml 
2022-09-03 03:48:37,775 686 INFO db-simple2 odoo.modules.loading: Module l10n_br_account: loading demo 
2022-09-03 03:48:37,776 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account/demo/res_users_demo.xml 
2022-09-03 03:48:38,312 686 INFO db-simple2 odoo.modules.loading: Module l10n_br_account loaded in 3.80s, 2010 queries 
2022-09-03 03:48:38,312 686 INFO db-simple2 odoo.modules.loading: Loading module l10n_br_account_nfe (46/46) 
2022-09-03 03:48:38,830 686 INFO db-simple2 odoo.modules.registry: module l10n_br_account_nfe: creating or updating database tables 
2022-09-03 03:48:39,324 686 INFO db-simple2 odoo.modules.loading: loading l10n_br_account_nfe/views/account_payment_mode.xml 
2022-09-03 03:48:39,357 686 INFO db-simple2 odoo.modules.loading: Module l10n_br_account_nfe: loading demo 
2022-09-03 03:48:39,540 686 WARNING db-simple2 odoo.modules.loading: Transient module states were reset 
2022-09-03 03:48:39,545 686 ERROR db-simple2 odoo.modules.registry: Failed to load registry 
2022-09-03 03:48:39,545 686 CRITICAL db-simple2 odoo.service.server: Failed to initialize database `db-simple2`. 
Traceback (most recent call last):
  File "/odoo/src/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/odoo/src/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/odoo/src/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('ir.model.data', <function IrModelData.xmlid_lookup at 0x7fb9ca71c400>, 'l10n_br_coa_simple.sale_journal_empresa_sn')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/odoo/src/odoo/tools/convert.py", line 677, in _tag_root
    f(rec)
  File "/odoo/src/odoo/tools/convert.py", line 564, in _tag_record
    f_val = self.id_get(f_ref)
  File "/odoo/src/odoo/tools/convert.py", line 660, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
  File "/odoo/src/odoo/tools/convert.py", line 666, in model_id_get
    return self.env['ir.model.data'].xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
  File "/odoo/src/odoo/addons/base/models/ir_model.py", line 1928, in xmlid_to_res_model_res_id
    return self.xmlid_lookup(xmlid)[1:3]
  File "<decorator-gen-36>", line 2, in xmlid_lookup
  File "/odoo/src/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/odoo/src/odoo/addons/base/models/ir_model.py", line 1921, in xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: l10n_br_coa_simple.sale_journal_empresa_sn

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/odoo/src/odoo/service/server.py", line 1199, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/odoo/src/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/odoo/src/odoo/modules/loading.py", line 461, in load_modules
    loaded_modules, update_module, models_to_check)
  File "/odoo/src/odoo/modules/loading.py", line 349, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/odoo/src/odoo/modules/loading.py", line 240, in load_module_graph
    getattr(py_module, post_init)(cr, registry)
  File "/odoo/links/l10n_br_account_nfe/hooks.py", line 10, in post_init_hook
    load_simples_nacional_demo(env, registry)
  File "/odoo/links/l10n_br_account_nfe/hooks.py", line 34, in load_simples_nacional_demo
    kind="demo",
  File "/odoo/src/odoo/tools/convert.py", line 733, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/odoo/src/odoo/tools/convert.py", line 799, in convert_xml_import
    obj.parse(doc.getroot())
  File "/odoo/src/odoo/tools/convert.py", line 719, in parse
    self._tag_root(de)
  File "/odoo/src/odoo/tools/convert.py", line 685, in _tag_root
    )) from e
odoo.tools.convert.ParseError: while parsing /odoo/links/l10n_br_account_nfe/demo/account_invoice_sn_demo.xml:47, near
<record id="demo_nfe_dados_de_cobranca" model="account.move">
        <field name="name">Teste NFe Dados de Cobrança</field>
        <field name="journal_id" ref="l10n_br_coa_simple.sale_journal_empresa_sn"/>
        <field name="company_id" ref="l10n_br_base.empresa_simples_nacional"/>
        <field name="invoice_payment_term_id" ref="account_payment_term_30_60_90"/>
        <field name="partner_id" ref="l10n_br_base.res_partner_akretion"/>
        <field name="move_type">out_invoice</field>
        <field name="invoice_user_id" ref="base.user_admin"/>
        <field name="payment_mode_id" ref="demo_payment_mode_boleto"/>
        <field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda"/>
        <field name="document_type_id" ref="l10n_br_fiscal.document_55"/>
        <field name="document_serie_id" ref="l10n_br_fiscal.empresa_sn_document_55_serie_1"/>
        <field name="document_serie">1</field>
        <field name="invoice_line_ids" eval="[         (0, 0, {             'product_id': ref('product.product_product_5'),             'quantity': 1,             'price_unit': 1000,             'company_id': ref('l10n_br_base.empresa_simples_nacional'),             'partner_id': ref('l10n_br_base.res_partner_akretion'),             'uom_id': ref('uom.product_uom_unit'),             'fiscal_operation_id': ref('l10n_br_fiscal.fo_venda'),             'fiscal_operation_line_id': ref('l10n_br_fiscal.fo_venda_revenda_nao_contribuinte'),             'cfop_id': ref('l10n_br_fiscal.cfop_5102'),             'ncm_id': ref('l10n_br_fiscal.ncm_84714900'),         })]"/>
    </record>

Sera se então no hook do modulo l10n_br_account a gente não deveria ter um hook para carregar os diairios de demo dos modulos l10n_br_coa_simple e l10n_br_coa_generic caso eles tiverem instalados ja?

relacionado: ja que os dados de demo e de testes ficam mais completos com os o l10n_br_coa_simple e o l10n_br_br_coa_generic instalados, a gente tanta instalar eles ja no hook do l10n_br_account se tiver os dados de demo. Porem na v14 esse hook do l10n_br_account nao faz o papel dele como foi escrito aqui: https://github.com/OCA/l10n-brazil/pull/2005#pullrequestreview-1048649391

cc @renatonlima @mbcosta @netosjb @marcelsavegnago

renan-prometheus-arch commented 1 year ago

Traceback (most recent call last): File "/opt/odoo14/odoo/odoo/http.py", line 652, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo14/odoo/odoo/http.py", line 317, in _handle_exception raise exception.with_traceback(None) from new_cause odoo.tools.convert.ParseError: while parsing /opt/odoo14/odoo/addons/l10n_br_account_nfe/demo/account_invoice_sn_demo.xml:47, near

Teste NFe Dados de Cobrança out_invoice 1
github-actions[bot] commented 8 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.