[FIX] pos_restaurant: US tipping should not be set by default

In SaaS, the DB is pre-prepared with the generic chart of accounts before the
new user finishes the form. Since the default country of the generic chart of
accounts is the US, then `set_tip_after_payment` option in the pre-created
pos.config is set to True. Now, when the form is submitted, the country is
identified but the said option remains to be True. This is a problem because not
all customers are creating an odoo instance for a US company. So customers from
other countries will have the option activated by default which is not a good
default for them.

We introduced this behavior in aa1c5b53bf131c6df96ad621e00bd2ee3d44c6c0 and in
this commit we won't set the option by default anymore.

closes odoo/odoo#149542

Task-id: 3635635
Signed-off-by: Vlad Stroia (vlst) <vlst@odoo.com>
This commit is contained in:
Joseph Caburnay
2024-03-18 13:28:05 +00:00
parent ac32d43a69
commit 06e0a005a3
@@ -61,15 +61,6 @@ class PosConfig(models.Model):
forbidden_keys.append('floor_ids')
return forbidden_keys
def _set_tips_after_payment_if_country_custom(self):
self.ensure_one()
company = self.company_id or self.env.company or self.env['res.company']._get_main_company()
if company and company.country_id and company.country_id.code == 'US':
self.update({
'iface_tipproduct': True,
'set_tip_after_payment': True,
})
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
@@ -134,7 +125,6 @@ class PosConfig(models.Model):
def _setup_main_restaurant_defaults(self):
self.ensure_one()
self._set_tips_after_payment_if_country_custom()
self._link_same_non_cash_payment_methods_if_exists('point_of_sale.pos_config_main')
self._ensure_cash_payment_method('MRCSH', _('Cash Restaurant'))
self._archive_shop()