diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2018-05-29 10:55:50 +0200 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2018-06-04 11:06:09 +0200 |
| commit | 79f0658c10c2ae77b2c891a823a5b60cfda6fefa (patch) | |
| tree | 91af7db0302055bb8e34933fdcefd2a294e174c9 | |
| parent | dae6efa9a5d38589e5dd7265864a33c7c9f460d4 (diff) | |
[FIX] point_of_sale: pos_config write should be @multi compliant
Avoid "expected singleton" when writing on multiple pos_config
closes #24953
| -rw-r--r-- | addons/point_of_sale/models/pos_config.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index db88b7c6638..efca9a08428 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -351,11 +351,12 @@ class PosConfig(models.Model): @api.multi def write(self, vals): - if (self.is_posbox or vals.get('is_posbox')) and (self.iface_customer_facing_display or vals.get('iface_customer_facing_display')): - facing_display = (self.customer_facing_display_html or vals.get('customer_facing_display_html') or '').strip() - if not facing_display: - vals['customer_facing_display_html'] = self._compute_default_customer_html() result = super(PosConfig, self).write(vals) + + config_display = self.filtered(lambda c: c.is_posbox and c.iface_customer_facing_display and not (c.customer_facing_display_html or '').strip()) + if config_display: + super(PosConfig, config_display).write({'customer_facing_display_html': self._compute_default_customer_html()}) + self.sudo()._set_fiscal_position() self.sudo()._check_modules_to_install() self.sudo()._check_groups_implied() |
