[MERGE] forward port of branch 8.0 up to d80376a
This commit is contained in:
@@ -1612,7 +1612,9 @@ class mail_thread(osv.AbstractModel):
|
|||||||
|
|
||||||
# _mail_flat_thread: automatically set free messages to the first posted message
|
# _mail_flat_thread: automatically set free messages to the first posted message
|
||||||
if self._mail_flat_thread and model and not parent_id and thread_id:
|
if self._mail_flat_thread and model and not parent_id and thread_id:
|
||||||
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
|
message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model), ('type', '=', 'email')], context=context, order="id ASC", limit=1)
|
||||||
|
if not message_ids:
|
||||||
|
message_ids = message_ids = mail_message.search(cr, uid, ['&', ('res_id', '=', thread_id), ('model', '=', model)], context=context, order="id ASC", limit=1)
|
||||||
parent_id = message_ids and message_ids[0] or False
|
parent_id = message_ids and message_ids[0] or False
|
||||||
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
|
# we want to set a parent: force to set the parent_id to the oldest ancestor, to avoid having more than 1 level of thread
|
||||||
elif parent_id:
|
elif parent_id:
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class pos_order_report(osv.osv):
|
|||||||
sum(l.qty * u.factor) as product_qty,
|
sum(l.qty * u.factor) as product_qty,
|
||||||
sum(l.qty * l.price_unit) as price_total,
|
sum(l.qty * l.price_unit) as price_total,
|
||||||
sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
|
sum((l.qty * l.price_unit) * (l.discount / 100)) as total_discount,
|
||||||
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
|
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal as average_price,
|
||||||
sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
|
sum(cast(to_char(date_trunc('day',s.date_order) - date_trunc('day',s.create_date),'DD') as int)) as delay_validation,
|
||||||
s.partner_id as partner_id,
|
s.partner_id as partner_id,
|
||||||
s.state as state,
|
s.state as state,
|
||||||
|
|||||||
@@ -333,13 +333,14 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||||||
c.height = height
|
c.height = height
|
||||||
var ctx = c.getContext('2d');
|
var ctx = c.getContext('2d');
|
||||||
ctx.drawImage(self.company_logo,0,0, width, height);
|
ctx.drawImage(self.company_logo,0,0, width, height);
|
||||||
|
|
||||||
self.company_logo_base64 = c.toDataURL();
|
self.company_logo_base64 = c.toDataURL();
|
||||||
logo_loaded.resolve();
|
logo_loaded.resolve();
|
||||||
};
|
};
|
||||||
self.company_logo.onerror = function(){
|
self.company_logo.onerror = function(){
|
||||||
logo_loaded.reject();
|
logo_loaded.reject();
|
||||||
};
|
};
|
||||||
|
self.company_logo.crossOrigin = "anonymous";
|
||||||
self.company_logo.src = '/web/binary/company_logo' +'?_'+Math.random();
|
self.company_logo.src = '/web/binary/company_logo' +'?_'+Math.random();
|
||||||
|
|
||||||
return logo_loaded;
|
return logo_loaded;
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||||||
'product_id': _get_advance_product,
|
'product_id': _get_advance_product,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _translate_advance(self, cr, uid, percentage=False, context=None):
|
||||||
|
return _("Advance of %s %%") if percentage else _("Advance of %s %s")
|
||||||
|
|
||||||
def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None):
|
def onchange_method(self, cr, uid, ids, advance_payment_method, product_id, context=None):
|
||||||
if advance_payment_method == 'percentage':
|
if advance_payment_method == 'percentage':
|
||||||
return {'value': {'amount':0, 'product_id':False }}
|
return {'value': {'amount':0, 'product_id':False }}
|
||||||
@@ -104,16 +107,17 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||||||
if wizard.advance_payment_method == 'percentage':
|
if wizard.advance_payment_method == 'percentage':
|
||||||
inv_amount = sale.amount_total * wizard.amount / 100
|
inv_amount = sale.amount_total * wizard.amount / 100
|
||||||
if not res.get('name'):
|
if not res.get('name'):
|
||||||
res['name'] = _("Advance of %s %%") % (wizard.amount)
|
res['name'] = self._translate_advance(cr, uid, percentage=True, context=dict(context, lang=sale.partner_id.lang)) % (wizard.amount)
|
||||||
else:
|
else:
|
||||||
inv_amount = wizard.amount
|
inv_amount = wizard.amount
|
||||||
if not res.get('name'):
|
if not res.get('name'):
|
||||||
#TODO: should find a way to call formatLang() from rml_parse
|
#TODO: should find a way to call formatLang() from rml_parse
|
||||||
symbol = sale.pricelist_id.currency_id.symbol
|
symbol = sale.pricelist_id.currency_id.symbol
|
||||||
if sale.pricelist_id.currency_id.position == 'after':
|
if sale.pricelist_id.currency_id.position == 'after':
|
||||||
res['name'] = _("Advance of %s %s") % (inv_amount, symbol)
|
symbol_order = (inv_amount, symbol)
|
||||||
else:
|
else:
|
||||||
res['name'] = _("Advance of %s %s") % (symbol, inv_amount)
|
symbol_order = (symbol, inv_amount)
|
||||||
|
res['name'] = self._translate_advance(cr, uid, context=dict(context, lang=sale.partner_id.lang)) % symbol_order
|
||||||
|
|
||||||
# determine taxes
|
# determine taxes
|
||||||
if res.get('invoice_line_tax_id'):
|
if res.get('invoice_line_tax_id'):
|
||||||
@@ -159,7 +163,6 @@ class sale_advance_payment_inv(osv.osv_memory):
|
|||||||
sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context)
|
sale_obj.write(cr, uid, sale_id, {'invoice_ids': [(4, inv_id)]}, context=context)
|
||||||
return inv_id
|
return inv_id
|
||||||
|
|
||||||
|
|
||||||
def create_invoices(self, cr, uid, ids, context=None):
|
def create_invoices(self, cr, uid, ids, context=None):
|
||||||
""" create invoices for the active sales orders """
|
""" create invoices for the active sales orders """
|
||||||
sale_obj = self.pool.get('sale.order')
|
sale_obj = self.pool.get('sale.order')
|
||||||
|
|||||||
@@ -1179,7 +1179,7 @@ class Binary(http.Controller):
|
|||||||
'/web/binary/company_logo',
|
'/web/binary/company_logo',
|
||||||
'/logo',
|
'/logo',
|
||||||
'/logo.png',
|
'/logo.png',
|
||||||
], type='http', auth="none")
|
], type='http', auth="none", cors="*")
|
||||||
def company_logo(self, dbname=None, **kw):
|
def company_logo(self, dbname=None, **kw):
|
||||||
imgname = 'logo.png'
|
imgname = 'logo.png'
|
||||||
placeholder = functools.partial(get_module_resource, 'web', 'static', 'src', 'img')
|
placeholder = functools.partial(get_module_resource, 'web', 'static', 'src', 'img')
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ class res_partner(osv.Model, format_address):
|
|||||||
'date': fields.date('Date', select=1),
|
'date': fields.date('Date', select=1),
|
||||||
'title': fields.many2one('res.partner.title', 'Title'),
|
'title': fields.many2one('res.partner.title', 'Title'),
|
||||||
'parent_id': fields.many2one('res.partner', 'Related Company', select=True),
|
'parent_id': fields.many2one('res.partner', 'Related Company', select=True),
|
||||||
|
'parent_name': fields.related('parent_id', 'name', type='char', readonly=True, string='Parent name'),
|
||||||
'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override
|
'child_ids': fields.one2many('res.partner', 'parent_id', 'Contacts', domain=[('active','=',True)]), # force "active_test" domain to bypass _search() override
|
||||||
'ref': fields.char('Contact Reference', select=1),
|
'ref': fields.char('Contact Reference', select=1),
|
||||||
'lang': fields.selection(_lang_get, 'Language',
|
'lang': fields.selection(_lang_get, 'Language',
|
||||||
@@ -591,7 +592,7 @@ class res_partner(osv.Model, format_address):
|
|||||||
for record in self.browse(cr, uid, ids, context=context):
|
for record in self.browse(cr, uid, ids, context=context):
|
||||||
name = record.name
|
name = record.name
|
||||||
if record.parent_id and not record.is_company:
|
if record.parent_id and not record.is_company:
|
||||||
name = "%s, %s" % (record.parent_id.name, name)
|
name = "%s, %s" % (record.parent_name, name)
|
||||||
if context.get('show_address_only'):
|
if context.get('show_address_only'):
|
||||||
name = self._display_address(cr, uid, record, without_company=True, context=context)
|
name = self._display_address(cr, uid, record, without_company=True, context=context)
|
||||||
if context.get('show_address'):
|
if context.get('show_address'):
|
||||||
@@ -791,7 +792,7 @@ class res_partner(osv.Model, format_address):
|
|||||||
'state_name': address.state_id.name or '',
|
'state_name': address.state_id.name or '',
|
||||||
'country_code': address.country_id.code or '',
|
'country_code': address.country_id.code or '',
|
||||||
'country_name': address.country_id.name or '',
|
'country_name': address.country_id.name or '',
|
||||||
'company_name': address.parent_id.name or '',
|
'company_name': address.parent_name or '',
|
||||||
}
|
}
|
||||||
for field in self._address_fields(cr, uid, context=context):
|
for field in self._address_fields(cr, uid, context=context):
|
||||||
args[field] = getattr(address, field) or ''
|
args[field] = getattr(address, field) or ''
|
||||||
|
|||||||
Reference in New Issue
Block a user