-
-
Notifications
You must be signed in to change notification settings - Fork 250
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][l10n_br_account][IMP] composite account.move #2761
Conversation
Hi @renatonlima, |
044cae8
to
2528ed5
Compare
2528ed5
to
68f3b59
Compare
184f8d9
to
43e6c91
Compare
Como ta a situação dessa proposta @rvalyi ? Já da pra testar de forma concreta? |
vou subir uns testes em breve... |
337ecd8
to
74f9560
Compare
@felipemotter @antoniospneto @marcelsavegnago @renatonlima @mbcosta @mileo The PR is ready now for review now. I made e few changes and added a complete test suite (it's inside the test_account_move_lc.py file to avoid loading a fake chart of account another time, which would make the tests much slower). As you can see, I added the fiscal_document_ids computed field with proper comments. Some extra checks are added in the case the user tries to perform an action on a move with several different fiscal documents. Especially the fiscal view button now open the list of the related fiscal documents in the case there are more than 1. Also now, in the UI, you can either:
@felipemotter @antoniospneto you could probably use that to merge several CTe's into the same bill for instance. cc @douglascstd . Mileo you were also concerned with the need for such a feature for the NFSe's a few years ago... Just to be clear: I could have made the NFe importation (#2781) work without this, but it would give me almost 2x more work as these two PRs share many concerns. |
Eu atualizei o PR de importação da NFe com esses 4 commits #2781 (comment) |
if values.get("fiscal_document_line_id"): | ||
fiscal_line_data = ( | ||
self.env["l10n_br_fiscal.document.line"] | ||
.browse(values["fiscal_document_line_id"]) | ||
.read(self._shadowed_fields())[0] | ||
) | ||
for k, v in fiscal_line_data.items(): | ||
if isinstance(v, tuple): # m2o | ||
values[k] = v[0] | ||
else: | ||
values[k] = v | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rvalyi eu não certerza se compreendi bem aqui, aqui você faz o inverso do que é feito _inject_shadowed_fields()
?
ao invés de sincronizar o fiscal_line com o move_line, vc tá sincronizando o move_line com o fiscal_line isso ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh isso sim. Nos testes desse PR eu testo isso de forma um pouco superficial, mas se vc testa de importar uma NFe em #2781 vai testar isso de forma bem funda. Inclusive eu penso botar outros testes depois em #2781 antes do merge...
Ai pelo sistema do _inherits a sincronização acontece de forma natural pelo framework (ou seja o account.move.line vai puxar os valoras fiscais da linha de documento fiscal pelo _inherits).
Os únicos campos que a gente tem que lidar são aqueles que são "shadowed" ou seja que não vão ser herdado mas que precisam ser duplicados no account.move.line. Esse código lida com essa copia desses 4 ou 5 campos.
Irei revisar logo. |
74f9560
to
9638520
Compare
@rvalyi pode fazer um rebase? |
9638520
to
b216bd2
Compare
feito. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, do ponto de vista financeiro depois será necessário pensar em algumas melhorias, caso somente umas das linhas tenha sido cancelada.
- Seja removendo a linha ou dividindo o documento em dois, só com a parte não cancelada.
- Ou inserindo uma linha negativa para abater o valor.
- Ou até um reembolso da parte cancelada.
a ideia é meio que definir uma "topologia" que funciona e que não conflita com a importação dos documentos fiscais (a NFe no caso). Depois da sim para melhorar muitas coisas em volta disso. Inclusive, vale a pena vc pensar bem se quer continuar fazer a NFSe como vc fez hoje somando todas linhas na mesma NFSe, pois poderia fazer uma NFSe por linha tb. |
@rvalyi pode dar um rebase por favor ? |
b216bd2
to
e8bc9bd
Compare
feito |
e8bc9bd
to
09893ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR has the |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at ee37297. Thanks a lot for contributing to OCA. ❤️ |
A single account.move can now eventually have different l10n_br_fiscal.document from its invoice_line_ids. This can be useful to import several CTe's or several NFSe's under the same account.move as these fiscal document allow only 1 item line and as this is usually done in other ERP's. At least we are reusing the _onchange_fiscal_document_line_id from this feature to properly complete the account.move.line with their proper onchanges.
This PR is used in the NFe importation PR #2781