diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 4b2352bc880..6c710dc2c04 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -553,18 +553,17 @@ class account_analytic_account(osv.osv): 'nodestroy': True, } - def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None): + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): if not template_id: return {} - obj_analytic_line = self.pool.get('account.analytic.invoice.line') res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) template = self.browse(cr, uid, template_id, context=context) - if not fix_price_invoices: + if not ids: res['value']['fix_price_invoices'] = template.fix_price_invoices res['value']['amount_max'] = template.amount_max - if not invoice_on_timesheets: + if not ids: res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets res['value']['hours_qtt_est'] = template.hours_qtt_est @@ -572,7 +571,7 @@ class account_analytic_account(osv.osv): res['value']['to_invoice'] = template.to_invoice.id if template.pricelist_id.id: res['value']['pricelist_id'] = template.pricelist_id.id - if not recurring_invoices: + if not ids: invoice_line_ids = [] for x in template.recurring_invoice_line_ids: invoice_line_ids.append((0, 0, { diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index c6c238c92b6..df10eeefff6 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -38,9 +38,6 @@ {'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]} - - on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices) - diff --git a/addons/event/email_template.xml b/addons/event/email_template.xml index d99774acd3c..d4479bcfc87 100644 --- a/addons/event/email_template.xml +++ b/addons/event/email_template.xml @@ -9,7 +9,7 @@ Your registration at ${object.event_id.name} Hello ${object.name},

-

The event ${object.event_id.name} that you registered for is confirmed and will be held from ${object.event_id.date_begin} to ${object.event_id.date_end}. +

The event ${object.event_id.name} that you registered for is confirmed and will be held from ${object.event_id.date_begin_located.strftime('%Y-%m-%d %H:%M:%S (%Z)')} to ${object.event_id.date_end_located.strftime('%Y-%m-%d %H:%M:%S (%Z)')}. For any further information please contact our event department.

Thank you for your participation!

Best regards

]]>
diff --git a/addons/event/event.py b/addons/event/event.py index 5e5d1204a17..a31ec00b8c0 100644 --- a/addons/event/event.py +++ b/addons/event/event.py @@ -18,7 +18,8 @@ # along with this program. If not, see . # ############################################################################## - +import pytz +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT from datetime import datetime, timedelta from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -156,6 +157,22 @@ class event_event(osv.osv): for event in self.browse(cr, uid, ids, context=context) } + def _compute_date_tz(self, cr, uid, ids, fld, arg, context=None): + if context is None: + context = {} + res = {} + for event in self.browse(cr, uid, ids, context=context): + ctx = dict(context, tz=(event.date_tz or 'UTC')) + if fld == 'date_begin_located': + date_to_convert = event.date_begin + elif fld == 'date_end_located': + date_to_convert = event.date_end + res[event.id] = fields.datetime.context_timestamp(cr, uid, datetime.strptime(date_to_convert, DEFAULT_SERVER_DATETIME_FORMAT), context=ctx) + return res + + def _tz_get(self, cr, uid, context=None): + return [(x, x) for x in pytz.all_timezones] + _columns = { 'name': fields.char('Event Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}), 'user_id': fields.many2one('res.users', 'Responsible User', readonly=False, states={'done': [('readonly', True)]}), @@ -175,8 +192,11 @@ class event_event(osv.osv): store={'event.registration': (_get_events_from_registrations, ['state'], 10), 'event.event': (lambda self, cr, uid, ids, c = {}: ids, ['seats_max', 'registration_ids'], 20)}), 'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}), + 'date_tz': fields.selection(_tz_get, string='Timezone'), 'date_begin': fields.datetime('Start Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'date_end': fields.datetime('End Date', required=True, readonly=True, states={'draft': [('readonly', False)]}), + 'date_begin_located': fields.function(_compute_date_tz, string='Start Date Located', type="datetime"), + 'date_end_located': fields.function(_compute_date_tz, string='End Date Located', type="datetime"), 'state': fields.selection([ ('draft', 'Unconfirmed'), ('cancel', 'Cancelled'), @@ -204,7 +224,8 @@ class event_event(osv.osv): 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'event.event', context=c), 'user_id': lambda obj, cr, uid, context: uid, 'organizer_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id, - 'address_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id + 'address_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, context=c).company_id.partner_id.id, + 'date_tz': lambda self, cr, uid, ctx: ctx.get('tz', "UTC"), } def _check_seats_limit(self, cr, uid, ids, context=None): diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index fba7424ff95..49f3613e2a7 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -89,6 +89,7 @@ + diff --git a/addons/mass_mailing/__openerp__.py b/addons/mass_mailing/__openerp__.py index e96cc910920..e0a8ab041fe 100644 --- a/addons/mass_mailing/__openerp__.py +++ b/addons/mass_mailing/__openerp__.py @@ -48,6 +48,8 @@ professional emails and reuse templates in a few clicks. 'views/res_config.xml', 'views/res_partner.xml', 'views/email_template.xml', + 'views/website_mass_mailing.xml', + 'views/snippets.xml', 'security/ir.model.access.csv', 'views/mass_mailing.xml', ], diff --git a/addons/mass_mailing/data/mass_mailing_data.xml b/addons/mass_mailing/data/mass_mailing_data.xml index 6bd1df79a72..7137bfcf29b 100644 --- a/addons/mass_mailing/data/mass_mailing_data.xml +++ b/addons/mass_mailing/data/mass_mailing_data.xml @@ -33,5 +33,10 @@ 30 + + + Newsletter + + \ No newline at end of file diff --git a/addons/mass_mailing/data/mass_mailing_demo.xml b/addons/mass_mailing/data/mass_mailing_demo.xml index 569feec9c88..d5a84419f93 100644 --- a/addons/mass_mailing/data/mass_mailing_demo.xml +++ b/addons/mass_mailing/data/mass_mailing_demo.xml @@ -9,7 +9,7 @@ - + Imported Contacts @@ -17,17 +17,17 @@ Aristide Antario aa@example.com - + Beverly Bridge bb@example.com - + Carol Cartridge cc@example.com - + diff --git a/addons/mass_mailing/static/src/img/blocks/button_newsletter.png b/addons/mass_mailing/static/src/img/blocks/button_newsletter.png new file mode 100644 index 00000000000..46a63ef9b00 Binary files /dev/null and b/addons/mass_mailing/static/src/img/blocks/button_newsletter.png differ diff --git a/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js b/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js new file mode 100644 index 00000000000..4caba1d29b5 --- /dev/null +++ b/addons/mass_mailing/static/src/js/website_mass_mailing.editor.js @@ -0,0 +1,40 @@ +(function () { + 'use strict'; + + var website = openerp.website; + var _t = openerp._t; + + website.snippet.options.mailing_list_subscribe = website.snippet.Option.extend({ + on_prompt: function () { + var self = this; + return website.prompt({ + id: "editor_new_mailing_list_subscribe_button", + window_title: _t("Add a Newsletter Subscribe Button"), + select: _t("Newsletter"), + init: function (field) { + return website.session.model('mail.mass_mailing.list') + .call('name_search', ['', []], { context: website.get_context() }); + }, + }).then(function (mailing_list_id) { + self.$target.attr("data-list-id", mailing_list_id); + }); + }, + drop_and_build_snippet: function() { + var self = this; + this._super(); + this.on_prompt().fail(function () { + self.editor.on_remove(); + }); + }, + start : function () { + var self = this; + this.$el.find(".js_mailing_list").on("click", _.bind(this.on_prompt, this)); + this._super(); + }, + clean_for_save: function () { + this.$target.addClass("hidden"); + }, + }); +})(); + + diff --git a/addons/mass_mailing/static/src/js/website_mass_mailing.js b/addons/mass_mailing/static/src/js/website_mass_mailing.js new file mode 100644 index 00000000000..5776fadfb3f --- /dev/null +++ b/addons/mass_mailing/static/src/js/website_mass_mailing.js @@ -0,0 +1,57 @@ +(function () { + 'use strict'; + + var website = openerp.website; + + website.snippet.animationRegistry.subscribe = website.snippet.Animation.extend({ + selector: ".js_subscribe", + start: function (editable_mode) { + var self = this; + + // set value and display button + self.$target.find("input").removeClass("hidden"); + openerp.jsonRpc('/website_mass_mailing/is_subscriber', 'call', { + list_id: this.$target.data('list-id'), + }).always(function (data) { + self.$target.find('input.js_subscribe_email') + .val(data.email ? data.email : "") + .attr("disabled", data.is_subscriber && data.email.length ? "disabled" : false); + self.$target.attr("data-subscribe", data.is_subscriber ? 'on' : 'off'); + self.$target.find('a.js_subscribe_btn') + .val(data.email ? data.email : "") + .attr("disabled", data.is_subscriber && data.email.length ? "disabled" : false); + self.$target.removeClass("hidden"); + }); + + // not if editable mode to allow designer to edit alert field + if (!editable_mode) { + $('.js_subscribe > .alert').addClass("hidden"); + $('.js_subscribe > .input-group-btn.hidden').removeClass("hidden"); + this.$target.find('.js_subscribe_btn').on('click', function (event) { + event.preventDefault(); + self.on_click(); + }); + } + }, + on_click: function () { + var self = this; + var $email = this.$target.find(".js_subscribe_email:visible"); + + if ($email.length && !$email.val().match(/.+@.+/)) { + this.$target.addClass('has-error'); + return false; + } + this.$target.removeClass('has-error'); + + openerp.jsonRpc('/website_mass_mailing/subscribe', 'call', { + 'list_id': this.$target.data('list-id'), + 'email': $email.length ? $email.val() : false, + }).then(function (subscribe) { + self.$target.find(".js_subscribe_email, .input-group-btn").addClass("hidden"); + self.$target.find(".alert").removeClass("hidden"); + self.$target.find('input.js_subscribe_email').attr("disabled", subscribe ? "disabled" : false); + self.$target.attr("data-subscribe", subscribe ? 'on' : 'off'); + }); + }, + }); +})(); diff --git a/addons/mass_mailing/views/snippets.xml b/addons/mass_mailing/views/snippets.xml new file mode 100644 index 00000000000..cefe2e7bdfd --- /dev/null +++ b/addons/mass_mailing/views/snippets.xml @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/addons/mass_mailing/views/website_mass_mailing.xml b/addons/mass_mailing/views/website_mass_mailing.xml new file mode 100644 index 00000000000..bc55f61400c --- /dev/null +++ b/addons/mass_mailing/views/website_mass_mailing.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index aa37c26b48d..beedac5fe96 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -27,6 +27,8 @@ import openerp.addons.decimal_precision as dp from openerp.tools.translate import _ import openerp +PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent')] + class procurement_group(osv.osv): ''' The procurement group class is used to group products together @@ -113,7 +115,7 @@ class procurement_order(osv.osv): 'company_id': fields.many2one('res.company', 'Company', required=True), # These two fields are used for shceduling - 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent')], 'Priority', required=True, select=True, track_visibility='onchange'), + 'priority': fields.selection(PROCUREMENT_PRIORITIES, 'Priority', required=True, select=True, track_visibility='onchange'), 'date_planned': fields.datetime('Scheduled Date', required=True, select=True, track_visibility='onchange'), 'group_id': fields.many2one('procurement.group', 'Procurement Group'), diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 5e21055208c..6acc6a7bfd0 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -84,7 +84,9 @@ Dashboard / Reports for Warehouse Management will include: 'report/report_stock_view.xml', 'res_config_view.xml', 'views/report_package_barcode.xml', - 'views/report_stockpicking.xml', + 'views/report_lot_barcode.xml', + 'views/report_location_barcode.xml', + 'views/report_stockpicking.xml', 'views/report_stockinventory.xml', 'views/stock.xml', ], diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py index 42a86a32db4..0a574579808 100644 --- a/addons/stock/procurement.py +++ b/addons/stock/procurement.py @@ -188,6 +188,7 @@ class procurement_order(osv.osv): 'date': newdate, 'date_expected': newdate, 'propagate': procurement.rule_id.propagate, + 'priority': procurement.priority, } return vals @@ -288,7 +289,7 @@ class procurement_order(osv.osv): self._procure_orderpoint_confirm(cr, SUPERUSER_ID, use_new_cursor=False, company_id=company.id, context=context) #Search all confirmed stock_moves and try to assign them - confirmed_ids = move_obj.search(cr, uid, [('state', '=', 'confirmed')], limit=None, order='picking_priority desc, date_expected asc', context=context) + confirmed_ids = move_obj.search(cr, uid, [('state', '=', 'confirmed')], limit=None, order='priority desc, date_expected asc', context=context) for x in xrange(0, len(confirmed_ids), 100): move_obj.action_assign(cr, uid, confirmed_ids[x:x + 100], context=context) if use_new_cursor: diff --git a/addons/stock/product.py b/addons/stock/product.py index 732ab25cd80..0cf7df5e836 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -168,9 +168,16 @@ class product_product(osv.osv): res.append(('id', 'in', ids)) return res + def _product_available_text(self, cr, uid, ids, field_names=None, arg=False, context=None): + res = {} + for product in self.browse(cr, uid, ids, context=context): + res[product.id] = str(product.qty_available) + _(" In Stock") + return res + _columns = { 'reception_count': fields.function(_stock_move_count, string="Reception", type='integer', multi='pickings'), 'delivery_count': fields.function(_stock_move_count, string="Delivery", type='integer', multi='pickings'), + 'qty_in_stock': fields.function(_product_available_text, type='char'), 'qty_available': fields.function(_product_available, multi='qty_available', type='float', digits_compute=dp.get_precision('Product Unit of Measure'), string='Quantity On Hand', diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 103133d0ae0..b482f2aeab3 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -200,12 +200,17 @@ - +