Skip to content

Commit

Permalink
Merge PR #3619 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Feb 13, 2025
2 parents da77f08 + 1e4780d commit 3474494
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
15 changes: 15 additions & 0 deletions l10n_br_sale_stock/tests/test_sale_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,18 @@ def test_down_payment(self):
)
assert down_payment_line, "Invoice without Down Payment line."
invoice.action_post()

def test_generate_document_number_on_invoice_create_wizard(self):
"""Test Invoicing Picking with Document Number"""
self.set_sale_invoicing_policy()
sale_order = self.env.ref("l10n_br_sale_stock.main_company-sale_order_1")
sale_order.action_confirm()
picking = sale_order.picking_ids
picking.picking_type_id.pre_generate_fiscal_document_number = "validate"
self.picking_move_state(picking)
self.assertTrue(picking.document_number)
invoice = self.create_invoice_wizard(picking)
self.assertEqual(picking.document_number, invoice.document_number)
self.assertEqual(
picking.document_number, invoice.fiscal_document_id.document_number
)
11 changes: 11 additions & 0 deletions l10n_br_sale_stock/wizards/stock_invoice_onshipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
class StockInvoiceOnshipping(models.TransientModel):
_inherit = "stock.invoice.onshipping"

def _get_fields_not_used_from_sale(self):
"""Fields not used from Sale 'prepare' method"""
fields_not_used = super()._get_fields_not_used_from_sale()
fields_not_used.update(
{
"document_number",
"document_serie",
}
)
return fields_not_used

def _build_invoice_values_from_pickings(self, pickings):
"""
Build dict to create a new invoice from given pickings
Expand Down

0 comments on commit 3474494

Please sign in to comment.