Closed santostelmo closed 2 years ago
@simahawk keeping the original code and doing that could be acceptable for you ?
def _handle_tech_name(self, vals):
# make sure technical names are always there
if not vals.get("tech_name") and vals.get("name"):
name = vals.get("name")
if self.search_count([('name', '=', name)]) >= 1 and vals.get("company_id"):
# Name suffix with company ID to avoid duplicated technames in multy company
name += "-" + str(vals["company_id"])
vals["tech_name"] = self._normalize_tech_name(name)
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.
Default
tech_name
field is filled from recordname
. We have an issue with multi companies. For example, if we tr to set the char of accounts for 2 companies, jornal names and tech_names are populated with the same values in both companies. To avoid that for models defined per company, we change thetech_name
unique constraint rule.