diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index bb480b534aa..a3bd8de17ca 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -405,7 +405,7 @@ class AccountInvoice(models.Model): default_model='account.invoice', default_res_id=self.id, default_use_template=bool(template), - default_template_id=template.id, + default_template_id=template and template.id or False, default_composition_mode='comment', mark_invoice_as_sent=True, custom_layout="account.mail_template_data_notification_email_account_invoice" diff --git a/addons/anonymization/wizard/anonymize_wizard.py b/addons/anonymization/wizard/anonymize_wizard.py index 15db541a794..a0b355d4330 100644 --- a/addons/anonymization/wizard/anonymize_wizard.py +++ b/addons/anonymization/wizard/anonymize_wizard.py @@ -164,7 +164,7 @@ class IrModelFieldsAnonymizeWizard(models.TransientModel): table_name = self.env[model_name]._table # get the current value - self.env.cr.execute("select id, %s from %s" % (field_name, table_name)) + self.env.cr.execute('select id, "%s" from "%s"' % (field_name, table_name)) for record in self.env.cr.dictfetchall(): data.append({"model_id": model_name, "field_id": field_name, "id": record['id'], "value": record[field_name]}) @@ -196,7 +196,7 @@ class IrModelFieldsAnonymizeWizard(models.TransientModel): if anonymized_value is None: raise UserError('%s: %s' % (error_type, _("Anonymized value can not be empty."))) - sql = "update %(table)s set %(field)s = %%(anonymized_value)s where id = %%(id)s" % { + sql = 'update "%(table)s" set "%(field)s" = %%(anonymized_value)s where id = %%(id)s' % { 'table': table_name, 'field': field_name, } @@ -285,7 +285,7 @@ class IrModelFieldsAnonymizeWizard(models.TransientModel): custom_updates.sort(key=itemgetter('sequence')) queries = [(record['query'], record['query_type']) for record in custom_updates if record['query_type']] elif table_name: - queries = [("update %(table)s set %(field)s = %%(value)s where id = %%(id)s" % { + queries = [('update "%(table)s" set "%(field)s" = %%(value)s where id = %%(id)s' % { 'table': table_name, 'field': line['field_id'], }, 'sql')] diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index e901c19d069..b54fec02bf0 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -705,7 +705,7 @@ class Message(models.Model): def _invalidate_documents(self): """ Invalidate the cache of the documents followed by ``self``. """ for record in self: - if record.res_id: + if record.model and record.res_id: self.env[record.model].invalidate_cache(ids=[record.res_id]) @api.model diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 939b3940b84..ca81393772d 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -189,6 +189,7 @@ td { height: 100%; display: table; border: none; + overflow: hidden; } .pos .window .subwindow{ display: table-row; @@ -213,6 +214,19 @@ td { position: relative; } +.pos .clientlist-screen .window, +.pos .clientlist-screen .full-content .subwindow{ + display: block; +} +.pos .clientlist-screen .full-content .subwindow-container{ + display: block; + height: 100%; +} +.pos .clientlist-screen .full-content .subwindow.collapsed, +.pos .clientlist-screen .full-content .subwindow-container.collapsed{ + height: auto; +} + /* ---- Scrollers ----- */ .pos .scroller-container{ @@ -703,6 +717,7 @@ td { display: inline-block; float: right; text-align: center; + width: 216px; margin: 16px; margin-top: 8px; margin-left: 0px; diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index f9cf49864d2..5b8933c4cc7 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -1335,6 +1335,9 @@ var ClientListScreenWidget = ScreenWidget.extend({ var new_height = contents.height(); if(!this.details_visible){ + // resize client list to take into account client details + parent.height('-=' + new_height); + if(clickpos < scroll + new_height + 20 ){ parent.scrollTop( clickpos - 20 ); }else{ @@ -1364,6 +1367,7 @@ var ClientListScreenWidget = ScreenWidget.extend({ }); } else if (visibility === 'hide') { contents.empty(); + parent.height('100%'); if( height > scroll ){ contents.css({height:height+'px'}); contents.animate({height:0},400,function(){ diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index 6fbdf01fa6e..051d4bee319 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -137,7 +137,10 @@ class PortalWizardUser(models.TransientModel): user_portal = None # create a user if necessary, and make sure it is in the portal group if not user: - company_id = wizard_user.partner_id.company_id.id + if wizard_user.partner_id.company_id: + company_id = wizard_user.partner_id.company_id.id + else: + company_id = self.env['res.company']._company_default_get('res.users') user_portal = wizard_user.sudo().with_context(company_id=company_id)._create_user() else: user_portal = user diff --git a/addons/stock/models/stock_inventory.py b/addons/stock/models/stock_inventory.py index 93796e7c320..f6c36541990 100644 --- a/addons/stock/models/stock_inventory.py +++ b/addons/stock/models/stock_inventory.py @@ -338,11 +338,11 @@ class InventoryLine(models.Model): theoretical_qty = self.product_id.uom_id._compute_quantity(theoretical_qty, self.product_uom_id) self.theoretical_qty = theoretical_qty - @api.onchange('product_id', 'product_uom_id') - def onchange_product_or_uom(self): + @api.onchange('product_id') + def onchange_product(self): res = {} # If no UoM or incorrect UoM put default one from product - if self.product_id and (not self.product_uom_id or self.product_id.uom_id.category_id != self.product_uom_id.category_id): + if self.product_id: self.product_uom_id = self.product_id.uom_id res['domain'] = {'product_uom_id': [('category_id', '=', self.product_id.uom_id.category_id.id)]} return res diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 030c2b3708e..a0fe0e707e7 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -378,7 +378,7 @@ class Website(models.Model): request.session['sale_order_id'] = sale_order.id if request.website.partner_id.id != partner.id: - partner.write({'last_website_so_id': sale_order_id}) + partner.write({'last_website_so_id': sale_order.id}) if sale_order: diff --git a/doc/cla/individual/sergiocorato.md b/doc/cla/individual/sergiocorato.md new file mode 100644 index 00000000000..5ac26c3f7ea --- /dev/null +++ b/doc/cla/individual/sergiocorato.md @@ -0,0 +1,9 @@ +Italy, 2017-01-24 + +I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Sergio Corato sergiocorato@gmail.com https://github.com/sergiocorato