diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index fd92026ce743e490d698540332ac007deadf775c..57b0a09bae231597102f23d65ca1b6e65d81d654 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -6738,12 +6738,6 @@ msgid "" "Would you like to proceed anyway?" msgstr "" -#. module: point_of_sale -#: code:addons/point_of_sale/models/pos_config.py:0 -#, python-format -msgid "You can only have one cash payment method." -msgstr "" - #. module: point_of_sale #: code:addons/point_of_sale/models/account_bank_statement.py:0 #, python-format diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index e6333a0966189888bd5c86f9bb1f1738e6b309a1..5cfbe5b68c7f29e336bb2cda4447b96bdce3bfcc 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -188,13 +188,6 @@ class PosConfig(models.Model): for config in self: config.cash_control = bool(config.payment_method_ids.filtered('is_cash_count')) - @api.onchange('payment_method_ids') - def _check_cash_payment_method(self): - for config in self: - if len(config.payment_method_ids.filtered('is_cash_count')) > 1: - config.payment_method_ids = config.payment_method_ids._origin - raise ValidationError(_('You can only have one cash payment method.')) - @api.depends('use_pricelist', 'available_pricelist_ids') def _compute_allowed_pricelist_ids(self): for config in self: diff --git a/addons/point_of_sale/tests/common.py b/addons/point_of_sale/tests/common.py index 1bdcd9a3b4d89d95985b0b57431af2354576d3a3..6aeebfdc33b7dfea1d6e0f7ddc42bf56cc5f7faa 100644 --- a/addons/point_of_sale/tests/common.py +++ b/addons/point_of_sale/tests/common.py @@ -332,16 +332,19 @@ class TestPoSCommon(ValuationReconciliationTestCommon): 'outstanding_account_id': cls.outstanding_bank.id, }) - new_config = cls.env['pos.config'].create({ - 'name': 'Shop Other', - 'invoice_journal_id': other_invoice_journal.id, - 'journal_id': other_sales_journal.id, - 'use_pricelist': True, - 'available_pricelist_ids': [(6, 0, [other_pricelist.id])], - 'pricelist_id': other_pricelist.id, - 'payment_method_ids': [(6, 0, [cls.cash_pm2.id, cls.bank_pm2.id])], - }) - return new_config + new_config = Form(cls.env['pos.config']) + new_config.name = 'Shop Other' + new_config.invoice_journal_id = other_invoice_journal + new_config.journal_id = other_sales_journal + new_config.use_pricelist = True + new_config.available_pricelist_ids.clear() + new_config.available_pricelist_ids.add(other_pricelist) + new_config.pricelist_id = other_pricelist + new_config.payment_method_ids.clear() + new_config.payment_method_ids.add(cls.cash_pm2) + new_config.payment_method_ids.add(cls.bank_pm2) + config = new_config.save() + return config @classmethod def _create_categ_anglo(cls):