Skip to content

Commit 28e11fe

Browse files
committed
[FIX] util/method: added variable to add_view
**Description:** The util method `add_view` was previously used to create views for `view_type` such as form, tree, and qweb. However, it lacked support for setting the `website_id`, which limited its ability to create website-specific views. This PR introduces a new `website_id` parameter to the `add_view` method. By adding this parameter, the method can now be used to create views specific to a website, enabling the creation of both backend views (form, tree, qweb) and frontend website views. **Changes:** - Added `website_id` parameter to the `add_view` method. - Adjusted the SQL query to include `website_id` where applicable. - Website views can now be created using this method by passing the appropriate `website_id`. This enhancement makes the `add_view` method more flexible, supporting both regular and website-specific views.
1 parent 062d11a commit 28e11fe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/records.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def get_trans_terms(value):
280280
)
281281

282282

283-
def add_view(cr, name, model, view_type, arch_db, inherit_xml_id=None, priority=16, key=None):
283+
def add_view(cr, name, model, view_type, arch_db, inherit_xml_id=None, priority=16, key=None, website_id=None):
284284
inherit_id = None
285285
if inherit_xml_id:
286286
inherit_id = ref(cr, inherit_xml_id)
@@ -311,6 +311,7 @@ def add_view(cr, name, model, view_type, arch_db, inherit_xml_id=None, priority=
311311
"priority": priority,
312312
"key": key,
313313
"arch_db": arch_column_value,
314+
"website_id": website_id,
314315
},
315316
)
316317
return cr.fetchone()[0]

0 commit comments

Comments
 (0)