Reset the printer's tray when the printer is changed

This commit is contained in:
Guewen Baconnier
2015-01-20 11:44:13 +01:00
parent cfdfc8e3a2
commit cacc5423f6
3 changed files with 17 additions and 2 deletions

View File

@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields
from openerp import models, fields, api
class IrActionsReportXml(models.Model):
@@ -30,3 +30,8 @@ class IrActionsReportXml(models.Model):
string='Paper Source',
domain="[('printer_id', '=', printing_printer_id)]",
)
@api.onchange('printing_printer_id')
def onchange_printing_printer_id(self):
""" Reset the tray when the printer is changed """
self.printer_tray_id = False

View File

@@ -37,3 +37,8 @@ class ReportXMLAction(models.Model):
res = super(ReportXMLAction, self).behaviour()
res['tray'] = self.printer_tray_id.system_name
return res
@api.onchange('printer_id')
def onchange_printer_id(self):
""" Reset the tray when the printer is changed """
self.printer_tray_id = False

View File

@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields
from openerp import models, fields, api
class ResUsers(models.Model):
@@ -30,3 +30,8 @@ class ResUsers(models.Model):
string='Default Printer Paper Source',
domain="[('printer_id', '=', printing_printer_id)]",
)
@api.onchange('printing_printer_id')
def onchange_printing_printer_id(self):
""" Reset the tray when the printer is changed """
self.printer_tray_id = False