From 473d52c242de1a5f8c2c424730a7ffc3ff6f4231 Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Fri, 6 Oct 2023 10:01:36 +0200 Subject: [PATCH] Add issue7677.diff [trytond] Do not set rec_name for unsaved record #162058 --- issue7677.diff | 14 ++++++++++++++ series | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 issue7677.diff diff --git a/issue7677.diff b/issue7677.diff new file mode 100644 index 0000000..06d4c62 --- /dev/null +++ b/issue7677.diff @@ -0,0 +1,14 @@ +diff --git a/tryton/trytond/trytond/model/modelview.py b/tryton/trytond/trytond/model/modelview.py +index 8d5cf199a8..ec32e02f57 100644 +--- a/tryton/trytond/trytond/model/modelview.py ++++ b/tryton/trytond/trytond/model/modelview.py +@@ -825,7 +825,8 @@ class ModelView(Model): + continue + if field._type in ('many2one', 'one2one', 'reference'): + if value: +- if isinstance(value, ModelStorage): ++ if isinstance(value, ModelStorage) ++ and value.id and value.id >= 0): + changed['%s.' % fname] = { + 'rec_name': value.rec_name, + } diff --git a/series b/series index 7eafa16..db888cf 100644 --- a/series +++ b/series @@ -53,3 +53,5 @@ issue12480.diff # [trytond] Support GIN index with btree_gin PostgreSQL extensio merge_request779.diff # [account_payment] Warn when submitting, approving or proceeding payment with reconciled line issue12576.diff # [account_stock_eu] Could not find the intrastat countries for moves + +issue7677.diff # [trytond] Do not set rec_name for unsaved record