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] l10n_br_fiscal: operation copy #3491

Open
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions l10n_br_fiscal/models/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,17 @@
def _onchange_operation_subsequent_ids(self):
for sub_operation in self.operation_subsequent_ids:
sub_operation.fiscal_operation_id = self.id

def copy(self, default=None):
"""
Inherit copy to edit field code. This is needed because the field is
Unique and Required.
"""
self.ensure_one()

Check warning on line 277 in l10n_br_fiscal/models/operation.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/operation.py#L277

Added line #L277 was not covered by tests
if default is None:
default = {}

Check warning on line 279 in l10n_br_fiscal/models/operation.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/operation.py#L279

Added line #L279 was not covered by tests
if self.code:
default["code"] = self.code + _(" (Copy)")

Check warning on line 281 in l10n_br_fiscal/models/operation.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/operation.py#L281

Added line #L281 was not covered by tests

res = super().copy(default)
return res

Check warning on line 284 in l10n_br_fiscal/models/operation.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_fiscal/models/operation.py#L283-L284

Added lines #L283 - L284 were not covered by tests
Loading