Skip to content

Commit

Permalink
[MERGE] forward port branch saas-11 up to 345755e
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Dec 6, 2016
2 parents 3fc879e + 345755e commit aec8e25
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 18 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -32,6 +32,7 @@ recursive-include odoo *.ttf
recursive-include odoo *.woff
recursive-include odoo *.woff2
recursive-include odoo *.wsdl
recursive-include odoo *.xls
recursive-include odoo *.xsd
recursive-include odoo *.xsl
recursive-include odoo *.xml
Expand Down
Expand Up @@ -1065,7 +1065,7 @@ var abstractReconciliationLine = Widget.extend({
var amount = line.tax_id ? line.amount_before_tax: line.amount;
dict['credit'] = (amount > 0 ? amount : 0);
dict['debit'] = (amount < 0 ? -1 * amount : 0);
if (line.tax_id) dict['tax_ids'] = [line.tax_id];
if (line.tax_id) dict['tax_ids'] = [[4, line.tax_id, null]];
if (line.analytic_account_id) dict['analytic_account_id'] = line.analytic_account_id;
return dict;
});
Expand Down
7 changes: 6 additions & 1 deletion addons/account_asset/models/account_asset.py
Expand Up @@ -204,7 +204,12 @@ def compute_depreciation_board(self):
if self.value_residual != 0.0:
amount_to_depr = residual_amount = self.value_residual
if self.prorata:
depreciation_date = datetime.strptime(self._get_last_depreciation_date()[self.id], DF).date()
# if we already have some previous validated entries, starting date is last entry + method perio
if posted_depreciation_line_ids and posted_depreciation_line_ids[-1].depreciation_date:
last_depreciation_date = datetime.strptime(posted_depreciation_line_ids[-1].depreciation_date, DF).date()
depreciation_date = last_depreciation_date + relativedelta(months=+self.method_period)
else:
depreciation_date = datetime.strptime(self._get_last_depreciation_date()[self.id], DF).date()
else:
# depreciation_date = 1st of January of purchase year if annual valuation, 1st of
# purchase month in other cases
Expand Down
14 changes: 7 additions & 7 deletions addons/mail/static/src/js/chat_manager.js
Expand Up @@ -18,10 +18,10 @@ var LIMIT = 25;
var preview_msg_max_size = 350; // optimal for native english speakers
var ODOOBOT_ID = "ODOOBOT";

var MessageModel = new Model('mail.message', session.context);
var ChannelModel = new Model('mail.channel', session.context);
var UserModel = new Model('res.users', session.context);
var PartnerModel = new Model('res.partner', session.context);
var MessageModel = new Model('mail.message', session.user_context);
var ChannelModel = new Model('mail.channel', session.user_context);
var UserModel = new Model('res.users', session.user_context);
var PartnerModel = new Model('res.partner', session.user_context);

// Private model
//----------------------------------------------------------------------------------
Expand Down Expand Up @@ -383,7 +383,7 @@ function fetch_from_channel (channel, options) {
domain = new data.CompoundDomain([['id', '<', min_message_id]], domain);
}

return MessageModel.call('message_fetch', [domain], {limit: LIMIT}).then(function (msgs) {
return MessageModel.call('message_fetch', [domain], {limit: LIMIT, context: session.user_context}).then(function (msgs) {
if (!cache.all_history_loaded) {
cache.all_history_loaded = msgs.length < LIMIT;
}
Expand All @@ -408,7 +408,7 @@ function fetch_document_messages (ids, options) {
if (options.force_fetch || _.difference(ids.slice(0, LIMIT), loaded_msg_ids).length) {
var ids_to_load = _.difference(ids, loaded_msg_ids).slice(0, LIMIT);

return MessageModel.call('message_format', [ids_to_load]).then(function (msgs) {
return MessageModel.call('message_format', [ids_to_load], {context: session.user_context}).then(function (msgs) {
var processed_msgs = [];
_.each(msgs, function (msg) {
processed_msgs.push(add_message(msg, {silent: true}));
Expand Down Expand Up @@ -952,7 +952,7 @@ var chat_manager = {
}
});
} else {
new Model(res_model).call('get_formview_id', [[res_id], session.context]).then(function (view_id) {
new Model(res_model).call('get_formview_id', [[res_id], session.user_context]).then(function (view_id) {
redirect_to_document(res_model, res_id, view_id);
});
}
Expand Down
2 changes: 1 addition & 1 deletion addons/point_of_sale/static/src/js/devices.js
Expand Up @@ -423,7 +423,7 @@ var ProxyDevice = core.Class.extend(core.mixins.PropertiesMixin,{
send_printing_job();
},function(error){
if (error) {
self.pos.chrome.screen_selector.show_popup('error-traceback',{
self.pos.gui.show_popup('error-traceback',{
'title': _t('Printing Error: ') + error.data.message,
'body': error.data.debug,
});
Expand Down
2 changes: 1 addition & 1 deletion addons/point_of_sale/static/src/js/screens.js
Expand Up @@ -1865,7 +1865,7 @@ var PaymentScreenWidget = ScreenWidget.extend({
var plines = order.get_paymentlines();
for (var i = 0; i < plines.length; i++) {
if (plines[i].get_type() === 'bank' && plines[i].get_amount() < 0) {
this.pos_widget.screen_selector.show_popup('error',{
this.gui.show_popup('error',{
'message': _t('Negative Bank Payment'),
'comment': _t('You cannot have a negative amount in a Bank payment. Use a cash payment method to return money to the customer.'),
});
Expand Down
18 changes: 11 additions & 7 deletions addons/website/controllers/main.py
Expand Up @@ -137,6 +137,7 @@ def robots(self):

@http.route('/sitemap.xml', type='http', auth="public", website=True)
def sitemap_xml_index(self):
current_website = request.website
Attachment = request.env['ir.attachment'].sudo()
View = request.env['ir.ui.view'].sudo()
mimetype = 'application/xml;charset=utf-8'
Expand All @@ -150,8 +151,8 @@ def create_sitemap(url, content):
'name': url,
'url': url,
})

sitemap = Attachment.search([('url', '=', '/sitemap.xml'), ('type', '=', 'binary')], limit=1)
dom = [('url', '=' , '/sitemap-%d.xml' % current_website.id), ('type', '=', 'binary')]
sitemap = Attachment.search(dom, limit=1)
if sitemap:
# Check if stored version is still valid
create_date = fields.Datetime.from_string(sitemap.create_date)
Expand All @@ -161,7 +162,9 @@ def create_sitemap(url, content):

if not content:
# Remove all sitemaps in ir.attachments as we're going to regenerated them
sitemaps = Attachment.search([('url', '=like', '/sitemap%.xml'), ('type', '=', 'binary')])
dom = [('type', '=', 'binary'), '|', ('url', '=like' , '/sitemap-%d-%%.xml' % current_website.id),
('url', '=' , '/sitemap-%d.xml' % current_website.id)]
sitemaps = Attachment.search(dom)
sitemaps.unlink()

pages = 0
Expand All @@ -175,24 +178,25 @@ def create_sitemap(url, content):
if urls.strip():
content = View.render_template('website.sitemap_xml', {'content': urls})
pages += 1
last_sitemap = create_sitemap('/sitemap-%d.xml' % pages, content)
last_sitemap = create_sitemap('/sitemap-%d-%d.xml' % (current_website.id, pages), content)
else:
break

if not pages:
return request.not_found()
elif pages == 1:
# rename the -id-page.xml => -id.xml
last_sitemap.write({
'url': "/sitemap.xml",
'name': "/sitemap.xml"
'url': "/sitemap-%d.xml" % current_website.id,
'name': "/sitemap-%d.xml" % current_website.id,
})
else:
# Sitemaps must be split in several smaller files with a sitemap index
content = View.render_template('website.sitemap_index_xml', {
'pages': range(1, pages + 1),
'url_root': request.httprequest.url_root,
})
create_sitemap('/sitemap.xml', content)
create_sitemap('/sitemap-%d.xml' % current_website.id, content)

return request.make_response(content, [('Content-Type', mimetype)])

Expand Down
1 change: 1 addition & 0 deletions addons/website/models/ir_http.py
Expand Up @@ -371,6 +371,7 @@ def generate(self, query=None, args={}):
query = query and query.startswith('website.') and query[8:] or query
if query:
domain += [('key', 'like', query)]
domain += ['|', ('website_id', '=', request.website.id), ('website_id', '=', False)]

views = View.search_read(domain, fields=['key', 'priority', 'write_date'], order='name')
for view in views:
Expand Down
11 changes: 11 additions & 0 deletions doc/cla/individual/hurrinico.md
@@ -0,0 +1,11 @@
Italy, 2016-11-25

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,

Nicola Malcontenti nicola.malcontenti@agilebg.com https://github.com/hurrinico
11 changes: 11 additions & 0 deletions doc/cla/individual/kurkop.md
@@ -0,0 +1,11 @@
Colombia, 2015-12-23

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,

Juan Pablo Arias jpa@devco.co https://github.com/kurkop
11 changes: 11 additions & 0 deletions doc/cla/individual/msmart.md
@@ -0,0 +1,11 @@
Germany, 2016-09-20

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,

Michael Martinides michael@martinides.de https://github.com/msmart
2 changes: 2 additions & 0 deletions odoo/addons/base/ir/ir_qweb/fields.py
Expand Up @@ -97,6 +97,8 @@ def record_to_html(self, record, field_name, options):
Converts the specified field of the browse_record ``record`` to HTML
:rtype: unicode
"""
if not record:
return False
value = record[field_name]
return False if value is False else record.env[self._name].value_to_html(value, options=options)

Expand Down
1 change: 1 addition & 0 deletions odoo/addons/base/res/res_country_data.xml
Expand Up @@ -354,6 +354,7 @@
<field file="base/static/img/country_flags/co.png" name="image" type="base64" />
<field name="currency_id" ref="COP" />
<field eval="57" name="phone_code" />
<field name="address_format" eval="'%(street)s\n%(street2)s\n%(city)s %(state_name)s %(zip)s\n%(country_name)s'" />
</record>
<record id="cr" model="res.country">
<field name="name">Costa Rica</field>
Expand Down
1 change: 1 addition & 0 deletions odoo/addons/base/res/res_currency_data.xml
Expand Up @@ -50,6 +50,7 @@
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="active" eval="False"/>
<field name="position">before</field>
</record>

<record id="CZK" model="res.currency">
Expand Down

0 comments on commit aec8e25

Please sign in to comment.