Skip to content

Commit

Permalink
[FIX] no longer reads fop from null sale/purchase
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoParadeda committed Aug 16, 2024
1 parent 2fd9cb9 commit 1a69d3a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions l10n_br_stock_account/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def _default_fiscal_operation(self):
if hasattr(self, "purchase_id") and hasattr(
self.purchase_id, "fiscal_operation_id"
):
if not self.purchase_id.fiscal_operation_id:
if self.purchase_id and not self.purchase_id.fiscal_operation_id:
fiscal_operation = False
if hasattr(self, "sale_id") and hasattr(
self.sale_id, "fiscal_operation_id"
Expand All @@ -40,7 +40,7 @@ def _default_fiscal_operation(self):
# if not self.sale_id.fiscal_operation_id:
# AttributeError: 'sale.order' object has no attribute
# 'fiscal_operation_id'
if not self.sale_id.fiscal_operation_id:
if self.sale_id and not self.sale_id.fiscal_operation_id:
fiscal_operation = False

return fiscal_operation
Expand Down

0 comments on commit 1a69d3a

Please sign in to comment.