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

[16.0][FIX+IMP] l10n_br_sale: Casos Sem Operação Fiscal ou Fora do Brasil #3598

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from

Conversation

mbcosta
Copy link
Contributor

@mbcosta mbcosta commented Jan 28, 2025

Cases without Fiscal Operation.

Alterações feitas:

  • No Pedido de Vendas informa a Operação Fiscal Padrão apenas para o caso da Empresa ser do Brasil, nas Linhas informa apenas quando a Operação estiver preenchida no Pedido

Sobre a Operação Fiscal Padrão na Linha surgiu uma questão que é se na Linha não deveria ser Operação informada no Pedido ao invés de ser a Padrão de Vendas da Empresa já que se o Usuário alterar a Operação no Pedido logo não deveria trazer essa Operação na Linha? Deixei como estava mas posso ver de alterar

  • Calculo dos Totais volta a chamar o super e apenas chama os métodos Fiscais do Brasil no caso de ter a Operação Fiscal informada

PR simples e uma continuação do que foi feito na v14 , mas isso é necessário porque está causando erro nos testes do módulo delivery e consequentemente na migração do l10n_br_delivery

2025-01-28 16:45:41,056 18 ERROR test_br odoo.addons.delivery.tests.test_delivery_cost: FAIL: TestDeliveryCost.test_00_delivery_cost
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/odoo/addons/delivery/tests/test_delivery_cost.py", line 109, in test_00_delivery_cost
    self.assertEqual(len(line), 1, "Delivery cost is not Added")
AssertionError: 0 != 1 : Delivery cost is not Added

2025-01-28 17:06:29,522 24 ERROR test_br odoo.addons.delivery.tests.test_delivery_cost: FAIL: TestDeliveryCost.test_01_taxes_on_delivery_cost
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/odoo/addons/delivery/tests/test_delivery_cost.py", line 293, in test_01_taxes_on_delivery_cost
    self.assertRecordValues(sale_order.order_line, [{'price_subtotal': 9.09, 'price_total': 10.45}])
  File "/usr/local/lib/python3.10/site-packages/odoo/tests/common.py", line 611, in assertRecordValues
    self.fail('\n'.join(errors))
AssertionError: The records and expected_values do not match.

==== Differences at index 0 ====
--- 

+++ 

@@ -1 +1 @@

-price_total:9.09
+price_total:10.450000000000001
 


2025-01-28 17:06:41,952 24 ERROR test_br odoo.addons.delivery.tests.test_delivery_cost: FAIL: TestDeliveryCost.test_delivery_real_cost
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/odoo/addons/delivery/tests/test_delivery_cost.py", line 364, in test_delivery_real_cost
    self.assertEqual(delivery_line.price_unit, picking.carrier_price)
AssertionError: 0.0 != 40.0


2025-01-28 17:07:14,559 24 ERROR test_br odoo.addons.delivery.tests.test_delivery_stock_move: FAIL: StockMoveInvoice.test_01_delivery_stock_move
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/odoo/addons/delivery/tests/test_delivery_stock_move.py", line 98, in test_01_delivery_stock_move
    self.assertEqual(moves[0].move_line_ids.sale_price, 1725.0, 'wrong shipping value')
AssertionError: 1500.0 != 1725.0 : wrong shipping value


2025-01-28 17:07:17,937 24 ERROR test_br odoo.addons.delivery.tests.test_delivery_stock_move: FAIL: StockMoveInvoice.test_02_delivery_stock_move
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/odoo/addons/delivery/tests/test_delivery_stock_move.py", line 141, in test_02_delivery_stock_move
    self.assertEqual(moves[0].move_line_ids[0].sale_price, 862.5, 'wrong shipping value')
AssertionError: 750.0 != 862.5 : wrong shipping value

OBS: Para corrigir os erros do LOG acima ainda é preciso alterar o l10n_br_stock_account e o l10n_br_delivery no mesmo sentido, vou subir isso logo em seguida

cc @OCA/local-brazil-maintainers

@OCA-git-bot
Copy link
Contributor

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

@@ -15,7 +15,8 @@ class SaleOrder(models.Model):

@api.model
def _default_fiscal_operation(self):
return self.env.company.sale_fiscal_operation_id
if self.env.company.country_id.code == "BR":
return self.env.company.sale_fiscal_operation_id
Copy link
Member

Choose a reason for hiding this comment

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

Aqui, se for fora do Brasil, a operação na empresa seria False e daria no mesmo não? O codio anterior era até mais simples no caso, não se vale a pena mudar aqui... Perdi algo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants