Skip to content

printer_zpl2: fix label._get_record method#430

Open
kirca wants to merge 1 commit into
OCA:18.0from
kirca:18.0-fix-printer_zpl2-test_record_id
Open

printer_zpl2: fix label._get_record method#430
kirca wants to merge 1 commit into
OCA:18.0from
kirca:18.0-fix-printer_zpl2-test_record_id

Conversation

@kirca
Copy link
Copy Markdown

@kirca kirca commented Nov 1, 2025

use model.browse() to check if the record exists.
model.search() by id doesn't work.

@pedrobaeza pedrobaeza added this to the 18.0 milestone Nov 3, 2025
Obj = self.env[self.model_id.model]
record = Obj.search([("id", "=", self.record_id)], limit=1)
if not record:
record = Obj.browse(self.record_id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
record = Obj.browse(self.record_id)
record = Obj.browse(self.record_id).exists()

@kirca kirca force-pushed the 18.0-fix-printer_zpl2-test_record_id branch from 1502c2d to 78f27a9 Compare November 3, 2025 12:18
use model.browse() to check if the record exists.
model.search() by `id` doesn't work.
@kirca kirca force-pushed the 18.0-fix-printer_zpl2-test_record_id branch from 78f27a9 to 79da3d7 Compare January 22, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants