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][FIX+IMP] l10n_br_sale_stock: Inform Fields that should not be used from Sale 'prepare' methods, tests #3619

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(

Check warning on line 13 in l10n_br_sale_stock/wizards/stock_invoice_onshipping.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_sale_stock/wizards/stock_invoice_onshipping.py#L12-L13

Added lines #L12 - L13 were not covered by tests
{
"document_number",
"document_serie",
}
)
return fields_not_used

Check warning on line 19 in l10n_br_sale_stock/wizards/stock_invoice_onshipping.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_sale_stock/wizards/stock_invoice_onshipping.py#L19

Added line #L19 was not covered by tests

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