This commit is contained in:
gsinghpal
2026-04-20 01:16:12 -04:00
parent 8217bb0ff6
commit 54e56ed0e6
39 changed files with 5600 additions and 1131 deletions

View File

@@ -0,0 +1,7 @@
env = env # noqa
mo49 = env['mrp.production'].browse(49)
print('id=49:', mo49.name, 'state=', mo49.state, 'company=', mo49.company_id.id)
mo47 = env['mrp.production'].browse(47)
print('id=47:', mo47.name, 'state=', mo47.state, 'company=', mo47.company_id.id)
res = env['mrp.production'].search([('state', '=', 'done')], order='id desc', limit=3)
for m in res: print('got:', m.id, m.name, m.state)

View File

@@ -0,0 +1,13 @@
env = env # noqa
# Same exact query the audit uses
print('attempt 1 (no sudo):')
mo = env['mrp.production'].search([('state', '=', 'done')], order='id desc', limit=1)
print(f'{mo.name} (id {mo.id})')
print('attempt 2 (.sudo()):')
mo2 = env['mrp.production'].sudo().search([('state', '=', 'done')], order='id desc', limit=1)
print(f'{mo2.name} (id {mo2.id})')
print('attempt 3 (read 5):')
mos = env['mrp.production'].sudo().search([('state', '=', 'done')], order='id desc', limit=5)
for m in mos: print(f'{m.name} (id {m.id})')