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][l10n_br_fiscal] selection_add 'product' #2974

Merged
merged 1 commit into from
Mar 25, 2024
Merged
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
12 changes: 12 additions & 0 deletions l10n_br_fiscal/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def _get_default_ncm_id(self):
if fiscal_type == PRODUCT_FISCAL_TYPE_SERVICE:
return self.env.ref(NCM_FOR_SERVICE_REF)

# Some modules of the repo depend on stock and have
# demo products of type 'product' (this type is added to product.template
# in the stock module).
# For some reason when running the tests, some inverse method fields then fail when
# reading 'product' value for the product type. It seems it is because l10n_br_fiscal
# doesn't depend on stock. But we don't want such a dependency.
# So a workaround to avoid the bug we add the 'product' value to the selection.
type = fields.Selection(
selection_add=[("product", "Storable Product")],
ondelete={"product": "set consu"},
)

fiscal_type = fields.Selection(
selection=PRODUCT_FISCAL_TYPE,
company_dependent=True,
Expand Down
Loading