Skip to content

Commit fa13b5d

Browse files
committed
fixes
1 parent c27bc48 commit fa13b5d

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/util/spreadsheet/data_wrappers.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,27 @@ def fields(self) -> List[str]:
155155
def fields(self, fields: List[str]):
156156
self.definition["columns"] = fields
157157

158+
@property
159+
def order_by(self):
160+
if "searchParams" not in self.definition:
161+
return []
162+
order_bys = self.definition["searchParams"].get("orderBy")
163+
if order_bys:
164+
return [{"field": order_by["name"], "asc": order_by["asc"]} for order_by in order_bys]
165+
return []
166+
167+
@order_by.setter
168+
def order_by(self, order_bys):
169+
if not order_bys:
170+
return
171+
self.definition["searchParams"]["orderBy"] = [
172+
{
173+
"name": order_by["field"],
174+
"asc": order_by["asc"],
175+
}
176+
for order_by in order_bys
177+
]
178+
158179

159180
class InsertListCmdV16:
160181
def __init__(self, cmd):

src/util/spreadsheet/fields.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def rename_field(cr, model, old, new, data, revisions = ()):
2929
return spreadsheet.data, transform_revisions_data(revisions, *adapters)
3030

3131
def remove_field_in_all_spreadsheets(cr, model, field):
32+
if field == "__last_update":
33+
return # concurrent updates
3234
apply_in_all_spreadsheets(cr, model, (lambda data, revisions_data: remove_field(cr, model, field, data, revisions_data)))
3335

3436
def remove_field(cr, model, field, data, revisions=()):

src/util/spreadsheet/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def apply_in_all_spreadsheets(cr, like_pattern, callback):
9494
_logger.info("upgrading snapshots")
9595
# upgrade snapshots
9696
for attachment_id, _res_model, _res_id, db_datas in read_spreadsheet_snapshots(cr):
97-
data, revisions = callback(cr, db_datas, [])
97+
data, revisions = callback(db_datas, [])
9898
write_attachment(cr, attachment_id, data)
9999

100100

0 commit comments

Comments
 (0)