[MERGE] forward port of branch 9.0 up to 28e2dcf

This commit is contained in:
Denis Ledoux
2016-01-28 14:36:57 +01:00
23 changed files with 146 additions and 105 deletions
@@ -81,7 +81,7 @@ class AccountBankStatement(models.Model):
@api.multi
def _is_difference_zero(self):
for bank_stmt in self:
bank_stmt.is_difference_zero = float_is_zero(bank_stmt.difference, bank_stmt.currency_id.decimal_places)
bank_stmt.is_difference_zero = float_is_zero(bank_stmt.difference, precision_digits=bank_stmt.currency_id.decimal_places)
@api.one
@api.depends('journal_id')
+1 -1
View File
@@ -97,7 +97,7 @@ class AccountInvoice(models.Model):
self.residual_signed = abs(residual) * sign
self.residual = abs(residual)
digits_rounding_precision = self.currency_id.rounding
if float_is_zero(self.residual, digits_rounding_precision):
if float_is_zero(self.residual, precision_rounding=digits_rounding_precision):
self.reconciled = True
else:
self.reconciled = False
+10 -4
View File
@@ -241,20 +241,26 @@ class AccountMoveLine(models.Model):
sign = 1 if (line.debit - line.credit) > 0 else -1
for partial_line in (line.matched_debit_ids + line.matched_credit_ids):
amount -= partial_line.amount
# If line is a credit (sign = -1) we:
# - subtract matched_debit_ids (partial_line.credit_move_id == line)
# - add matched_credit_ids (partial_line.credit_move_id != line)
# If line is a debit (sign = 1), do the opposite.
sign_partial_line = sign if partial_line.credit_move_id == line else (-1 * sign)
amount += sign_partial_line * partial_line.amount
#getting the date of the matched item to compute the amount_residual in currency
date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date
if line.currency_id:
if partial_line.currency_id and partial_line.currency_id == line.currency_id:
amount_residual_currency -= partial_line.amount_currency
amount_residual_currency += sign_partial_line * partial_line.amount_currency
else:
amount_residual_currency -= line.company_id.currency_id.with_context(date=date).compute(partial_line.amount, line.currency_id)
amount_residual_currency += sign_partial_line * line.company_id.currency_id.with_context(date=date).compute(partial_line.amount, line.currency_id)
#computing the `reconciled` field. As we book exchange rate difference on each partial matching,
#we can only check the amount in company currency
reconciled = False
digits_rounding_precision = line.company_id.currency_id.rounding
if float_is_zero(amount, digits_rounding_precision) and (line.debit or line.credit):
if float_is_zero(amount, precision_rounding=digits_rounding_precision) and (line.debit or line.credit):
reconciled = True
line.reconciled = reconciled
+2 -1
View File
@@ -19,7 +19,8 @@ def migrate_set_tags_and_taxes_updatable(cr, registry, module):
that need migration (for example in case of VAT report improvements)
'''
xml_record_ids = registry['ir.model.data'].search(cr, SUPERUSER_ID, [('model', 'in', ['account.tax.template', 'account.account.tag']), ('module', 'like', module)])
cr.execute("update ir_model_data set noupdate = 'f' where id in %s", (tuple(xml_record_ids),))
if xml_record_ids:
cr.execute("update ir_model_data set noupdate = 'f' where id in %s", (tuple(xml_record_ids),))
def migrate_tags_on_taxes(cr, registry):
''' This is a utiliy function to help migrate the tags of taxes when the localization has been modified on stable version. If
@@ -12,6 +12,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
res = []
self.total_account = []
cr = self.env.cr
user_company = self.env.user.company_id.id
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
@@ -25,7 +26,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND l.reconciled IS FALSE\
AND (l.partner_id = res_partner.id)\
AND (l.date <= %s)\
ORDER BY res_partner.name', (tuple(move_state), tuple(account_type), date_from))
AND l.company_id = %s \
ORDER BY res_partner.name', (tuple(move_state), tuple(account_type), date_from, user_company))
partners = cr.dictfetchall()
# put a total of 0
@@ -46,7 +48,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND (account_account.internal_type IN %s)\
AND (l.partner_id IN %s)\
AND (l.date <= %s)\
GROUP BY l.partner_id ', (tuple(move_state), tuple(account_type), tuple(partner_ids), date_from,))
AND l.company_id = %s \
GROUP BY l.partner_id ', (tuple(move_state), tuple(account_type), tuple(partner_ids), date_from, user_company))
partner_totals = cr.fetchall()
for partner_id, amount in partner_totals:
totals[partner_id] = amount
@@ -62,7 +65,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND (l.partner_id IN %s)\
AND l.reconciled IS FALSE\
AND l.date <= %s \
GROUP BY l.partner_id', (tuple(move_state), tuple(account_type), date_from, tuple(partner_ids), date_from))
AND l.company_id = %s \
GROUP BY l.partner_id', (tuple(move_state), tuple(account_type), date_from, tuple(partner_ids), date_from, user_company))
partner_totals = cr.fetchall()
for partner_id, amount in partner_totals:
future_past[partner_id] = amount
@@ -83,7 +87,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
else:
dates_query += ' <= %s)'
args_list += (form[str(i)]['stop'],)
args_list += (date_from,)
args_list += (date_from, user_company)
query = '''SELECT l.id
FROM account_move_line AS l, account_account, account_move am
@@ -93,11 +97,11 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND (l.partner_id IN %s)
AND ''' + dates_query + '''
AND (l.date <= %s)
GROUP BY l.partner_id, l.id'''
AND l.company_id = %s'''
cr.execute(query, args_list)
partners_amount = {}
aml_ids = cr.fetchall()
aml_ids = aml_ids and aml_ids[0] or []
aml_ids = aml_ids and [x[0] for x in aml_ids] or []
for line in self.env['account.move.line'].browse(aml_ids):
if line.partner_id.id not in partners_amount:
partners_amount[line.partner_id.id] = 0.0
@@ -150,6 +154,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
if target_move == 'posted':
move_state = ['posted']
user_company = self.env.user.company_id.id
## put a total of 0
for i in range(7):
self.total_account.append(0)
@@ -162,7 +167,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND (account_account.internal_type IN %s)\
AND l.reconciled IS FALSE \
AND (l.date <= %s)\
',(tuple(move_state), tuple(account_type), date_from,))
AND l.company_id = %s\
',(tuple(move_state), tuple(account_type), date_from, user_company))
total_amount = cr.fetchall()
for amount in total_amount:
totals['Unknown Partner'] = amount[0]
@@ -175,7 +181,8 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND (account_account.internal_type IN %s)\
AND (COALESCE(l.date_maturity,l.date) > %s)\
AND l.reconciled IS FALSE\
', (tuple(move_state), tuple(account_type), date_from,))
AND l.company_id = %s\
', (tuple(move_state), tuple(account_type), date_from, user_company))
total_amount = cr.fetchall()
for amount in total_amount:
future_past['Unknown Partner'] = amount[0]
@@ -193,7 +200,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
else:
dates_query += ' < %s)'
args_list += (form[str(i)]['stop'],)
args_list += (date_from,)
args_list += (date_from, user_company)
cr.execute('SELECT SUM(l.debit - l.credit)\
FROM account_move_line AS l, account_account, account_move am \
WHERE (l.account_id = account_account.id) AND (l.move_id = am.id)\
@@ -203,6 +210,7 @@ class ReportAgedPartnerBalance(models.AbstractModel):
AND l.reconciled IS FALSE\
AND ' + dates_query + '\
AND (l.date <= %s)\
AND l.company_id = %s\
GROUP BY l.partner_id', args_list)
total_amount = cr.fetchall()
history_data = {}
@@ -17,12 +17,12 @@ class ReportJournal(models.AbstractModel):
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_ids)] + query_get_clause[2]
query = 'SELECT "account_move_line".id FROM ' + query_get_clause[0] + ', account_move am WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ORDER BY '
query = 'SELECT "account_move_line".id FROM ' + query_get_clause[0] + ', account_move am, account_account acc WHERE "account_move_line".account_id = acc.id AND "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' ORDER BY '
if sort_selection == 'date':
query += '"account_move_line".date'
else:
query += 'am.name'
query += ', "account_move_line".move_id'
query += ', "account_move_line".move_id, acc.code'
self.env.cr.execute(query, tuple(params))
ids = map(lambda x: x[0], self.env.cr.fetchall())
return self.env['account.move.line'].browse(ids)
@@ -58,23 +58,32 @@ class ReportJournal(models.AbstractModel):
query_get_clause = self._get_query_get_clause(data)
params = [tuple(move_state), tuple(journal_id.ids)] + query_get_clause[2]
self.env.cr.execute('SELECT DISTINCT tax_line_id FROM ' + query_get_clause[0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' AND tax_line_id is not null',
tuple(params))
ids = map(lambda x: x[0], self.env.cr.fetchall())
taxes = self.env['account.tax'].browse(ids)
query = """
SELECT rel.account_tax_id, SUM("account_move_line".balance) AS base_amount
FROM account_move_line_account_tax_rel rel, """ + query_get_clause[0] + """
LEFT JOIN account_move am ON "account_move_line".move_id = am.id
WHERE "account_move_line".id = rel.account_move_line_id
AND am.state IN %s
AND "account_move_line".journal_id IN %s
AND """ + query_get_clause[1] + """
GROUP BY rel.account_tax_id"""
self.env.cr.execute(query, tuple(params))
ids = []
base_amounts = {}
for row in self.env.cr.fetchall():
ids.append(row[0])
base_amounts[row[0]] = row[1]
res = {}
for tax in taxes:
res[tax] = {}
for tax in self.env['account.tax'].browse(ids):
self.env.cr.execute('SELECT sum(debit - credit) FROM ' + query_get_clause[0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' AND tax_line_id = %s',
tuple(params + [tax.id]))
res[tax]['tax_amount'] = self.env.cr.fetchone()[0] or 0.0
amls = self.env['account.move.line'].search([('tax_ids', 'in', [tax.id])])
self.env.cr.execute('SELECT sum(debit - credit) FROM ' + query_get_clause[0] + ', account_move am '
'WHERE "account_move_line".move_id=am.id AND am.state IN %s AND "account_move_line".journal_id IN %s AND ' + query_get_clause[1] + ' AND "account_move_line".id in %s',
tuple(params + [tuple(amls.ids)]))
res[tax]['base_amount'] = self.env.cr.fetchone()[0] or 0.0
res[tax] = {
'base_amount': base_amounts[tax.id],
'tax_amount': self.env.cr.fetchone()[0] or 0.0,
}
if journal_id.type == 'sale':
#sales operation are credits
res[tax]['base_amount'] = res[tax]['base_amount'] * -1
+1 -2
View File
@@ -242,8 +242,7 @@ class product_pricelist(osv.osv):
break
# Final price conversion into pricelist currency
if suitable_rule and suitable_rule.compute_price != 'fixed' and suitable_rule.base != 'pricelist':
user_company = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id
price = self.pool['res.currency'].compute(cr, uid, user_company.currency_id.id, pricelist.currency_id.id, price, context=context)
price = self.pool['res.currency'].compute(cr, uid, product.currency_id.id, pricelist.currency_id.id, price, context=context)
results[product.id] = (price, suitable_rule and suitable_rule.id or False)
return results
+13 -8
View File
@@ -421,6 +421,17 @@ class product_template(osv.osv):
return product.write({'list_price': value})
def _product_currency(self, cr, uid, ids, name, arg, context=None):
try:
main_company = self.pool['ir.model.data'].get_object(cr, uid, 'base', 'main_company')
except ValueError:
company_ids = self.pool['res.company'].search(cr, uid, [], limit=1, order="id", context=context)
main_company = self.pool['res.company'].browse(cr, uid, company_ids[0], context=context)
res = {}
for product in self.browse(cr, uid, ids, context=context):
res[product.id] = product.company_id.currency_id.id or main_company.currency_id.id
return res
def _get_product_variant_count(self, cr, uid, ids, name, arg, context=None):
res = {}
for product in self.browse(cr, uid, ids, context=context):
@@ -477,11 +488,7 @@ class product_template(osv.osv):
'rental': fields.boolean('Can be Rent'),
'categ_id': fields.many2one('product.category','Internal Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"),
'price': fields.function(_product_template_price, fnct_inv=_set_product_template_price, type='float', string='Price', digits_compute=dp.get_precision('Product Price')),
'currency_id': fields.related(
'company_id', 'currency_id',
type='many2one',
relation='res.currency',
string='Currency'),
'currency_id': fields.function(_product_currency, type='many2one', relation='res.currency', string='Currency'),
'list_price': fields.float('Sale Price', digits_compute=dp.get_precision('Product Price'), help="Base price to compute the customer price. Sometimes called the catalog price."),
'lst_price' : fields.related('list_price', type="float", string='Public Price', digits_compute=dp.get_precision('Product Price')),
'standard_price': fields.function(_compute_product_template_field, fnct_inv=_set_product_template_field, fnct_search=_search_by_standard_price, multi='_compute_product_template_field', type='float', string='Cost', digits_compute=dp.get_precision('Product Price'),
@@ -556,8 +563,6 @@ class product_template(osv.osv):
if context is None:
context = {}
if 'currency_id' in context:
currency_id = self.pool['res.users'].browse(cr, uid, uid, context=context).company_id.currency_id.id
res = {}
product_uom_obj = self.pool.get('product.uom')
for product in products:
@@ -580,7 +585,7 @@ class product_template(osv.osv):
if 'currency_id' in context:
# Take current user company currency.
# This is right cause a field cannot be in more than one currency
res[product.id] = self.pool.get('res.currency').compute(cr, uid, currency_id,
res[product.id] = self.pool.get('res.currency').compute(cr, uid, product.currency_id.id,
context['currency_id'], res[product.id], context=context)
return res
@@ -70,7 +70,7 @@ class sale_order_line(osv.osv):
line.discount = 0.0
return res
@api.onchange('product_uom')
@api.onchange('product_uom', 'product_uom_qty')
def product_uom_change(self):
res = super(sale_order_line, self).product_uom_change()
if not self.product_uom:
+1 -1
View File
@@ -415,7 +415,7 @@
<field name="product_qty"/>
<field name="product_uom" groups="product.group_uom"/>
<field name="price_subtotal" widget="monetary"/>
<field name="date_planned" widget="date" width="135"/>
<field name="date_planned" widget="date"/>
</tree>
</field>
</record>
@@ -72,6 +72,7 @@ class purchase_report(osv.osv):
l.product_id,
p.product_tmpl_id,
t.categ_id as category_id,
s.currency_id,
t.uom_id as product_uom,
sum(l.product_qty/u.factor*u2.factor) as quantity,
extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
@@ -102,6 +103,7 @@ class purchase_report(osv.osv):
s.create_uid,
s.partner_id,
u.factor,
s.currency_id,
l.price_unit,
s.date_approve,
l.date_planned,
@@ -180,6 +180,9 @@ var ViewManagerAction = WidgetAction.extend({
* @return {jQuery} the view_manager's $el
*/
detach: function() {
// Hack to remove badly inserted nvd3 tooltips ; should be removed when upgrading nvd3 lib
$('body > .nvtooltip').remove();
return this.widget.$el.detach();
},
/**
+17 -12
View File
@@ -203,24 +203,29 @@
function process_job (job) {
var require = make_require(job);
var job_exec;
var def = $.Deferred();
try {
var def = $.Deferred();
$.when(job.factory.call(null, require)).then(
function (data) {
services[job.name] = data;
clearTimeout(time);
time = _.defer(odoo.process_jobs, jobs, services);
def.resolve();
}, function (e) {
job.rejected = e || true;
jobs.push(job);
def.resolve();
});
job_exec = job.factory.call(null, require);
jobs.splice(jobs.indexOf(job), 1);
job_deferred.push(def);
} catch (e) {
job.error = e;
}
if (!job.error) {
$.when(job_exec).then(
function (data) {
services[job.name] = data;
def.resolve();
odoo.process_jobs(jobs, services);
}, function (e) {
job.rejected = e || true;
jobs.push(job);
def.resolve();
}
);
}
}
function is_ready (job) {
@@ -19,10 +19,6 @@ var GraphView = View.extend({
icon: 'fa-bar-chart',
view_type: 'graph',
on_detach_callback: function () {
$('body > .nvtooltip').remove();
},
init: function(parent, dataset, view_id, options) {
this._super(parent, dataset, view_id, options);
+1 -1
View File
@@ -5,7 +5,7 @@
line-height: initial !important;
color: initial !important;
}
.oe_form_field_html_text iframe.o_readonly {
.oe_form_field_html_text .o_readonly {
min-height: 1em;
width: 100%;
margin: 0;
+1 -1
View File
@@ -73,7 +73,7 @@ var FieldTextHtmlSimple = widget.extend({
self.resize();
});
} else {
this.$content = $('<div class="note-editable o_readonly"/>');
this.$content = $('<div class="o_readonly"/>');
this.$textarea.hide().after(this.$content);
}
} else {
@@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0\n"
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-09-07 14:41+0000\n"
"PO-Revision-Date: 2015-09-07 14:41+0000\n"
"POT-Creation-Date: 2016-01-28 12:13+0000\n"
"PO-Revision-Date: 2016-01-28 12:13+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -59,21 +59,28 @@ msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:58
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:64
#, python-format
msgid "Enter e-mail addresses (one per line)"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:82
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:92
#, python-format
msgid "Follow these implementation guides to get the most out of Odoo."
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:121
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:149
#, python-format
msgid "Get more features with the Enterprise Edition!"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:131
#, python-format
msgid "Help us spread the word: Share Odoo's awesomeness with your friends!"
msgstr ""
@@ -129,32 +136,46 @@ msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:65
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:148
#, python-format
msgid "Odoo Enterprise"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:71
#, python-format
msgid "Pending invitations:"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/js/dashboard.js:109
#: code:addons/web_settings_dashboard/static/src/js/dashboard.js:107
#, python-format
msgid "Please provide valid email addresses"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:119
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:129
#, python-format
msgid "Social Share"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:10
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:43
#, python-format
msgid "Theme store"
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:152
#, python-format
msgid "Upgrade Now"
msgstr ""
#. module: web_settings_dashboard
#: model:ir.model,name:web_settings_dashboard.model_res_users
msgid "Users"
@@ -162,8 +183,15 @@ msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:97
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:107
#, python-format
msgid "You need to install some apps first."
msgstr ""
#. module: web_settings_dashboard
#. openerp-web
#: code:addons/web_settings_dashboard/static/src/xml/dashboard.xml:77
#, python-format
msgid "more"
msgstr ""
+1 -1
View File
@@ -163,7 +163,7 @@ class WebsiteMail(http.Controller):
except Exception:
return False
@http.route(['/website_mail/post/post'], type='http', method=['POST'], auth='public', website=True)
@http.route(['/website_mail/post/post'], type='http', methods=['POST'], auth='public', website=True)
def chatter_post(self, res_model='', res_id=None, message='', redirect=None, **kw):
res_id = int(res_id)
url = request.httprequest.referrer
+1 -1
View File
@@ -18,7 +18,7 @@ class website_payment(http.Controller):
acquirer.form = acquirer.sudo()._registration_render(request.env.user.partner_id.id, {'error': {}, 'error_message': [], 'return_url': '/my/payment_method', 'json': False, 'bootstrap_formatting': True})[0]
return request.website.render("website_payment.pay_methods", values)
@http.route(['/website_payment/delete/'], method=['POST'], type='http', auth="user", website=True)
@http.route(['/website_payment/delete/'], methods=['POST'], type='http', auth="user", website=True)
def delete(self, delete_pm_id=None):
if delete_pm_id:
pay_meth = request.env['payment.method'].browse(int(delete_pm_id))
@@ -29,7 +29,7 @@ class WebsiteMailController(WebsiteMail):
})
return message_data
@http.route(['/website_mail/post/post'], type='http', method=['POST'], auth='public', website=True)
@http.route(['/website_mail/post/post'], type='http', methods=['POST'], auth='public', website=True)
def chatter_post(self, res_model='', res_id=None, message='', redirect=None, **kw):
params = kw.copy()
params.pop('rating')
-7
View File
@@ -7987,13 +7987,6 @@ msgstr ""
msgid "Enable Light Multi Company"
msgstr ""
#. module: base
#: code:addons/base/res/res_config.py:479
#, python-format
msgid "Enabling this feature will install the following paying application(s) : \n"
"%s"
msgstr ""
#. module: base
#: selection:base.language.install,lang:0
msgid "English (AU)"
+9 -7
View File
@@ -194,19 +194,21 @@ class ir_sequence(models.Model):
return ''
def _interpolation_dict():
now = datetime.now(pytz.timezone(self.env.context.get('tz') or 'UTC'))
now = range_date = effective_date = datetime.now(pytz.timezone(self.env.context.get('tz') or 'UTC'))
if self.env.context.get('ir_sequence_date'):
t = datetime.strptime(self.env.context.get('ir_sequence_date'), '%Y-%m-%d')
else:
t = now
effective_date = datetime.strptime(self.env.context.get('ir_sequence_date'), '%Y-%m-%d')
if self.env.context.get('ir_sequence_date_range'):
range_date = datetime.strptime(self.env.context.get('ir_sequence_date_range'), '%Y-%m-%d')
sequences = {
'year': '%Y', 'month': '%m', 'day': '%d', 'y': '%y', 'doy': '%j', 'woy': '%W',
'weekday': '%w', 'h24': '%H', 'h12': '%I', 'min': '%M', 'sec': '%S'
}
res = {}
for key, sequence in sequences.iteritems():
res[key] = now.strftime(sequence)
res['range_' + key] = t.strftime(sequence)
res[key] = effective_date.strftime(sequence)
res['range_' + key] = range_date.strftime(sequence)
res['current_' + key] = now.strftime(sequence)
return res
@@ -248,7 +250,7 @@ class ir_sequence(models.Model):
seq_date = self.env['ir.sequence.date_range'].search([('sequence_id', '=', self.id), ('date_from', '<=', dt), ('date_to', '>=', dt)], limit=1)
if not seq_date:
seq_date = self._create_date_range_seq(dt)
return seq_date._next()
return seq_date.with_context(ir_sequence_date_range=seq_date.date_from)._next()
@api.multi
def next_by_id(self):
-16
View File
@@ -460,10 +460,6 @@ class res_config_settings(osv.osv_memory, res_config_module_installation_mixin):
cr, SUPERUSER_ID, [('name', '=', module_name.replace("module_", '')),
('state','in', ['to install', 'installed', 'to upgrade'])],
context=context)
installed_module_ids = module_pool.search(
cr, SUPERUSER_ID, [('name', '=', module_name.replace("module_", '')),
('state', 'in', ['uninstalled'])],
context=context)
if module_ids and not field_value:
dep_ids = module_pool.downstream_dependencies(cr, SUPERUSER_ID, module_ids, context=context)
@@ -476,18 +472,6 @@ class res_config_settings(osv.osv_memory, res_config_module_installation_mixin):
'message': _('Disabling this option will also uninstall the following modules \n%s') % message,
}
}
if installed_module_ids and field_value:
dep_ids = module_pool.upstream_dependencies(cr, SUPERUSER_ID, installed_module_ids, context=context)
dep_name = [x['display_name'] for x in module_pool.search_read(
cr, SUPERUSER_ID, ['|', ('id', 'in', installed_module_ids), ('id', 'in', dep_ids), ('application', '=', True)], context=context)]
if dep_name:
message = ''.join(["- %s \n" % name for name in dep_name])
return {
'warning': {
'title': _('Warning!'),
'message': _('Enabling this feature will install the following paying application(s) : \n%s') % message,
}
}
return {}
def _get_classified_fields(self, cr, uid, context=None):