[MERGE] forward port branch 10.0 up to 17c9208889

This commit is contained in:
Christophe Simonis
2017-12-12 11:05:29 +01:00
3 changed files with 10 additions and 3 deletions
-3
View File
@@ -1322,9 +1322,6 @@ class AccountInvoiceLine(models.Model):
self.price_unit = 0.0
domain['uom_id'] = []
else:
# Use the purchase uom by default
self.uom_id = self.product_id.uom_po_id
if part.lang:
product = self.product_id.with_context(lang=part.lang)
else:
@@ -59,6 +59,13 @@ class AccountInvoice(models.Model):
data['account_id'] = account.id
return data
def _onchange_product_id(self):
domain = super(AccountInvoice, self)._onchange_product_id()
if self.purchase_id:
# Use the purchase uom by default
self.uom_id = self.product_id.uom_po_id
return domain
# Load all unsold PO lines
@api.onchange('purchase_id')
def purchase_order_change(self):
@@ -199,12 +199,15 @@ class AssetsBundle(object):
return self.env['ir.attachment'].sudo().browse(attachment_ids)
def save_attachment(self, type, content, inc=None):
assert type in ('js', 'css')
ira = self.env['ir.attachment']
fname = '%s%s.%s' % (self.name, ('' if inc is None else '.%s' % inc), type)
mimetype = 'application/javascript' if type == 'js' else 'text/css'
values = {
'name': "/web/content/%s" % type,
'datas_fname': fname,
'mimetype' : mimetype,
'res_model': 'ir.ui.view',
'res_id': False,
'type': 'binary',