Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] website_sale: prevent typeerror when ribbon background color is False #159409

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/website_sale/models/product_ribbon.py
Expand Up @@ -24,11 +24,11 @@ def _compute_display_name(self):
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if 'bg_color' in vals and not '!important' in vals['bg_color']:
if vals.get('bg_color') and not '!important' in vals['bg_color']:
vals['bg_color'] += ' !important'
return super().create(vals_list)

def write(self, data):
if 'bg_color' in data and not '!important' in data['bg_color']:
if data.get('bg_color') and not '!important' in data['bg_color']:
data['bg_color'] += ' !important'
return super().write(data)