diff --git a/l10n_br_stock_account/tests/test_invoicing_picking.py b/l10n_br_stock_account/tests/test_invoicing_picking.py index 0bdaf3829af4..b5705174836c 100644 --- a/l10n_br_stock_account/tests/test_invoicing_picking.py +++ b/l10n_br_stock_account/tests/test_invoicing_picking.py @@ -569,3 +569,24 @@ def test_simples_nacional(self): invoice.fiscal_document_id, "Simples Nacional case should has Fiscal Document.", ) + + def test_generate_document_number_on_validate(self): + """Test Invoicing Picking""" + self._change_user_company(self.env.ref("base.main_company")) + picking = self.env.ref("l10n_br_stock_account.main_company-picking_1") + self._run_fiscal_onchanges(picking) + # Testa os Impostos Dedutiveis + picking.fiscal_operation_id.deductible_taxes = True + picking.picking_type_id.pre_generate_fiscal_document_number = "pack" + + self._run_fiscal_onchanges(picking) + picking.action_confirm() + picking.action_assign() + for move in picking.move_ids_without_package: + self._run_fiscal_line_onchanges(move) + move.quantity_done = move.product_uom_qty + + picking.action_put_in_pack() + picking.button_validate() + picking.set_to_be_invoiced() + self.assertTrue(picking.document_number)