mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
@@ -31,6 +31,7 @@ class PrintingPrinter(models.Model):
|
||||
_order = "name"
|
||||
|
||||
name = fields.Char(required=True, index=True)
|
||||
active = fields.Boolean(default=True)
|
||||
server_id = fields.Many2one(
|
||||
comodel_name="printing.server",
|
||||
string="Server",
|
||||
|
||||
@@ -61,7 +61,7 @@ class PrintingServer(models.Model):
|
||||
servers = self.search(domain)
|
||||
|
||||
res = True
|
||||
for server in servers:
|
||||
for server in servers.with_context(active_test=False):
|
||||
connection = server._open_connection(raise_on_error=raise_on_error)
|
||||
if not connection:
|
||||
server.printer_ids.write({"status": "server-error"})
|
||||
|
||||
@@ -89,6 +89,18 @@ class TestPrintingServer(TransactionCase):
|
||||
self.Model.action_update_printers()
|
||||
self.assertEqual("unavailable", rec_id.status)
|
||||
|
||||
@mock.patch("%s.cups" % model)
|
||||
def test_update_archived_printers(self, cups):
|
||||
""" It should update status even if printer is archived """
|
||||
rec_id = self.new_printer()
|
||||
rec_id.toggle_active()
|
||||
self.server.refresh()
|
||||
cups.Connection().getPrinters().get.return_value = False
|
||||
self.Model.action_update_printers()
|
||||
self.assertEqual(
|
||||
"unavailable", rec_id.status,
|
||||
)
|
||||
|
||||
@mock.patch("%s.cups" % model)
|
||||
def test_update_jobs_cron(self, cups):
|
||||
""" It should get all jobs from CUPS server """
|
||||
|
||||
@@ -33,6 +33,13 @@
|
||||
/>
|
||||
</header>
|
||||
<sheet>
|
||||
<widget
|
||||
name="web_ribbon"
|
||||
text="Archived"
|
||||
bg_color="bg-danger"
|
||||
attrs="{'invisible': [('active', '=', True)]}"
|
||||
/>
|
||||
<field name="active" invisible="1" />
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" />
|
||||
|
||||
Reference in New Issue
Block a user