Skip to content

Commit

Permalink
fixup! fixup! [ADD] stock_picking_auto_print
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaudoux committed Dec 16, 2022
1 parent fdb2477 commit e0be80e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions printing_auto_base/models/printing_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def check_report(self):
if rec.file_type == "report" and not rec.report_id:
raise UserError(_("Report was not set"))

def do_print(self, pickings):
def do_print(self, picking):
self.ensure_one()
picking.ensure_one()

behaviour = self.get_behaviour()
printer = behaviour["printer"]
Expand All @@ -65,16 +66,15 @@ def do_print(self, pickings):

if self.nbr_of_copies <= 0:
return (printer, 0)
if not self._check_condition(picking):
return (printer, 0)

count = 0
for picking in pickings:
if not self._check_condition(picking):
continue
record = self._get_record(picking)
for content in self.get_content(record):
for _n in range(self.nbr_of_copies):
printer.print_document(report=None, content=content, **behaviour)
count += 1
record = self._get_record(picking)
for content in self.get_content(record):
for _n in range(self.nbr_of_copies):
printer.print_document(report=None, content=content, **behaviour)
count += 1
return (printer, count)

def get_behaviour(self):
Expand Down
4 changes: 2 additions & 2 deletions printing_auto_stock_picking/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def send_documents_to_printer(self):
if count:
self.message_post(
body=_(
"Report {name} sent to printer {printer}"
).format(name=auto, printer=printer)
"{name}: {count} document(s) sent to printer {printer}"
).format(name=auto, count=count, printer=printer)
)
except Exception:
_logger.exception(
Expand Down

0 comments on commit e0be80e

Please sign in to comment.