Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][ADD] l10n_br_cte: add new module #3492

Merged

Conversation

marcelsavegnago
Copy link
Member

No description provided.

@OCA-git-bot
Copy link
Contributor

Hi @renatonlima, @rvalyi,
some modules you are maintaining are being modified, check this out!

@marcelsavegnago
Copy link
Member Author

Ainda vou ajustar os commits e deixar mais organizado.

@marcelsavegnago
Copy link
Member Author

@mileo da uma olhada no arquivo de contribuintes e se tiver mais alguem me passa o nome e o email aqui por favor.

@marcelsavegnago
Copy link
Member Author

@mileo por favor peça para seu time dar uma revisada.. por ora comentei os trechos da transmissao mas ja da para validar a geracao do xml.

@marcelsavegnago
Copy link
Member Author

marcelsavegnago commented Nov 14, 2024

@rvalyi da uma olhada neste commit por favor e veja se faz sentido algo assim para voce.. df937a4

@rvalyi
Copy link
Member

rvalyi commented Nov 14, 2024

@rvalyi da uma olhada neste commit por favor e veja se faz sentido algo assim para voce.. df937a4

Então teve essa atualização importante #3127

Vale a pena testar se continua funcionando com essa atualização... talvez dar o merge dela primeiro ou pelo menos conferir num PR...

@marcelsavegnago
Copy link
Member Author

@rvalyi da uma olhada neste commit por favor e veja se faz sentido algo assim para voce.. df937a4

Então teve essa atualização importante #3127

Vale a pena testar se continua funcionando com essa atualização... talvez dar o merge dela primeiro ou pelo menos conferir num PR...

vou dar mais uma tapa nas coisas para ter algo rodando bonitinho e ja testo com esta PR..

Copy link
Member

@rvalyi rvalyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 problemas nos meus testes superficiais:

1: faltou o menu de CTe:
2024-11-14_19-45

2: erro quando usa o menu "all documents" e depois create:
2024-11-14_19-43

@marcelsavegnago
Copy link
Member Author

marcelsavegnago commented Nov 15, 2024

@rvalyi se puder efetuar novamente os testes eu agradeco.

@rvalyi
Copy link
Member

rvalyi commented Nov 15, 2024

@rvalyi se puder efetuar novamente os testes eu agradeco.

Ficou bastante melhor. Porem se vc for em Fiscal>Documents>All Documents>Create continua aquele erro:

Error:
Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/opt/odoo/odoo/http.py", line 696, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/http.py", line 370, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/http.py", line 358, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/http.py", line 919, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/http.py", line 544, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/addons/web/controllers/main.py", line 1370, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/main.py", line 1362, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 406, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 391, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/addons/account/models/account_move.py", line 1170, in onchange
    return super(AccountMove, self.with_context(recursive_onchanges=False)).onchange(values, field_name, field_onchange)
  File "/opt/odoo/odoo/models.py", line 6296, in onchange
    parent[name] = record[name]
  File "/opt/odoo/odoo/models.py", line 5727, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/opt/odoo/odoo/fields.py", line 1043, in __get__
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 1199, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/addons/mail/models/mail_thread.py", line 410, in _compute_field_value
    return super()._compute_field_value(field)
  File "/opt/odoo/odoo/models.py", line 4089, in _compute_field_value
    odoo.fields.determine(field.compute, self)
  File "/opt/odoo/odoo/fields.py", line 86, in determine
    return needle(records, *args)
  File "/opt/odoo/odoo/fields.py", line 575, in _compute_related
    record[self.name] = self._process_related(value[self.related_field.name])
  File "/opt/odoo/odoo/models.py", line 5727, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/opt/odoo/odoo/fields.py", line 1050, in __get__
    raise ValueError("Compute method failed to assign %s.%s" % (record, self.name))
Exception

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

Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 652, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/http.py", line 317, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Compute method failed to assign l10n_br_fiscal.document(<NewId 0x7f4c16e9c3d0>,).cte40_vTPrest

Não testei muito ainda mas pelo menos vi esse...

@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_cte-rebased-multi_schema-refactor branch 11 times, most recently from 8117dc4 to 2b81e67 Compare November 19, 2024 15:00
@marcelsavegnago marcelsavegnago force-pushed the 14.0-add-l10n_br_cte-rebased-multi_schema-refactor branch from f59dba0 to 2839b7d Compare December 10, 2024 13:48
Comment on lines +13 to +21
def match_or_create_m2o(self, rec_dict, parent_dict, model=None):
"""If state not found, break hard, don't create it"""

if rec_dict.get("code"):
domain = [("code", "=", rec_dict.get("code")), ("ibge_code", "!=", False)]
match = self.search(domain, limit=1)
if match:
return match.id
return False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui não precisamos chamar o super?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eu me tomei como base o que estava no modulo l10n_br_nfe, mas olhando agora, acredito que sim, falta o super tanto inclusive no l10n_br_nfe.. @rvalyi oq acha ?

Copy link
Member

@rvalyi rvalyi Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a gente poderia, mas tb não vejo grande problema não chamar. Pois esse metodo tem um dispatch para cada model ou comodel e apenas retorna um registro caso der match. Ou seja se vc quiser sobrecarregar não teria muita coisa para fazer com o result do parent. Podemos ajustar isso depois... cc @antoniospneto

rec.phone = rec.cte40_fone

@api.model
def match_or_create_m2o(self, rec_dict, parent_dict, model=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui também?

Copy link
Member

@rvalyi rvalyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

da para rolar merge, mas ai como vai ser nobump, @marcelsavegnago vc tem que dar uma incrementada nos módulos:

  • l10n_br_account (minor)
  • l10n_br_cte_spec (major eu diria)
  • l10n_br_fiscal (minor)
  • spec_driven_model (patch)

@marcelsavegnago
Copy link
Member Author

da para rolar merge, mas ai como vai ser nobump, @marcelsavegnago vc tem que dar uma incrementada nos módulos:

  • l10n_br_account (minor)
  • l10n_br_cte_spec (major eu diria)
  • l10n_br_fiscal (minor)
  • spec_driven_model (patch)

@rvalyi done

@mileo
Copy link
Member

mileo commented Dec 10, 2024

Merge! Merge! Merge!

image

Copy link
Member

@rvalyi rvalyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parabéns pelo trabalho ai! uma grande etapa na localização ainda*!
*But our princess is in another castle!

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-3492-by-rvalyi-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 42929d8. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit 2ca24ba into OCA:14.0 Dec 10, 2024
5 of 7 checks passed
@marcelsavegnago marcelsavegnago deleted the 14.0-add-l10n_br_cte-rebased-multi_schema-refactor branch December 10, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants