diff options
| author | Géry Debongnie <ged@odoo.com> | 2014-05-30 20:21:03 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2014-05-30 20:21:03 +0200 |
| commit | 52a8c4cf9aabf024cbfd1355d319fc160738c876 (patch) | |
| tree | 0a08bb77a7f65e04fd95a80469949c80055dbbaa | |
| parent | 907546eaf438cc459c4b4a1f0c94ebd945462d55 (diff) | |
| parent | 52b799d8d07d738dd61a93ae7fd15652b2b020d4 (diff) | |
[MERGE] merge from master
42 files changed, 427 insertions, 94 deletions
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 @@ <field name="partner_id" position="attributes"> <attribute name="attrs">{'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]}</attribute> </field> - <field name="template_id" position="attributes"> - <attribute name="on_change">on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices)</attribute> - </field> <xpath expr='//group[@name="invoice_on_timesheets"]' position="replace"> </xpath> <xpath expr='//separator[@name="description"]' position='before'> 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 @@ <field name="subject">Your registration at ${object.event_id.name}</field> <field name="body_html"><![CDATA[ <p>Hello ${object.name},</p> - <p>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}. + <p>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.</p> <p>Thank you for your participation!</p> <p>Best regards</p>]]></field> 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 <http://www.gnu.org/licenses/>. # ############################################################################## - +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 @@ <field name="type" on_change="onchange_event_type(type,context)" /> <field name="date_begin" on_change="onchange_start_date(date_begin,date_end)"/> <field name="date_end"/> + <field name="date_tz" /> </group> </group> <notebook> 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 @@ <field name="sequence">30</field> </record> + <!-- Create mailing lists --> + <record id="mass_mail_list_1" model="mail.mass_mailing.list"> + <field name="name">Newsletter</field> + </record> + </data> </openerp>
\ 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 @@ </record> <!-- Create mailing lists --> - <record id="mass_mail_list_1" model="mail.mass_mailing.list"> + <record id="mass_mail_list_2" model="mail.mass_mailing.list"> <field name="name">Imported Contacts</field> </record> @@ -17,17 +17,17 @@ <record id="mass_mail_contact_1" model="mail.mass_mailing.contact"> <field name="name">Aristide Antario</field> <field name="email">aa@example.com</field> - <field name="list_id" ref="mass_mailing.mass_mail_list_1"/> + <field name="list_id" ref="mass_mailing.mass_mail_list_2"/> </record> <record id="mass_mail_contact_2" model="mail.mass_mailing.contact"> <field name="name">Beverly Bridge</field> <field name="email">bb@example.com</field> - <field name="list_id" ref="mass_mailing.mass_mail_list_1"/> + <field name="list_id" ref="mass_mailing.mass_mail_list_2"/> </record> <record id="mass_mail_contact_3" model="mail.mass_mailing.contact"> <field name="name">Carol Cartridge</field> <field name="email">cc@example.com</field> - <field name="list_id" ref="mass_mailing.mass_mail_list_1"/> + <field name="list_id" ref="mass_mailing.mass_mail_list_2"/> <field name="opt_out" eval="True"/> </record> diff --git a/addons/mass_mailing/static/src/img/blocks/button_newsletter.png b/addons/mass_mailing/static/src/img/blocks/button_newsletter.png Binary files differnew file mode 100644 index 00000000000..46a63ef9b00 --- /dev/null +++ b/addons/mass_mailing/static/src/img/blocks/button_newsletter.png 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> + +<template id="mailing_list_subscribe" inherit_id="website.snippets" name="Subscribe to Newsletter"> + + <xpath expr="//div[@id='snippet_content']" position="inside"> + <div> + <div class="oe_snippet_thumbnail"> + <img class="oe_snippet_thumbnail_img" src="/mass_mailing/static/src/img/blocks/button_newsletter.png"/> + <span class="oe_snippet_thumbnail_title">Newsletter</span> + </div> + + <div class="oe_snippet_body input-group js_subscribe" + data-list-id="0"> + <input + type="email" + name="email" + class="js_subscribe_email form-control" + placeholder="your email..."/> + <span class="input-group-btn"> + <a href="#" class="btn btn-primary js_subscribe_btn">Subscribe</a> + </span> + <div class="alert alert-success hidden">Thanks for your subscription!</div> + </div> + + </div> + </xpath> + + <xpath expr="//div[@id='snippet_options']" position="inside"> + <div data-snippet-option-id='mailing_list_subscribe' + data-selector=".js_subscribe" + data-selector-siblings="p, h1, h2, h3, blockquote, .well, .panel" + > + <li> + <a href="#" class="button js_mailing_list">Change Newsletter</a> + </li> + </div> + </xpath> + +</template> + +</data> +</openerp> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> + +<template id="head" inherit_id="website.layout" name="Mail customization"> + <xpath expr="//head" position="inside"> + <script type="text/javascript" src="/mass_mailing/static/src/js/website_mass_mailing.editor.js" groups="base.group_website_publisher"></script> + <script type="text/javascript" src="/mass_mailing/static/src/js/website_mass_mailing.js"></script> + <link rel='stylesheet' href='/website_mail/static/src/css/website_mail.css'/> + </xpath> +</template> + +</data> +</openerp> 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 @@ </group> </group> <xpath expr="//div[@name='buttons']" position="inside"> - <button class="oe_inline oe_stat_button" string="Current Stock" name="%(product_open_quants)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations" icon="fa-bank"/> - <button class="oe_inline oe_stat_button" string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user" icon="fa-arrows-h"/> + <button class="oe_stat_button" + name="%(product_open_quants)d" + icon="fa-bank" + type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_locations"> + <div><field name="qty_in_stock"/></div> + </button> + <button class="oe_inline oe_stat_button" string="Moves" name= "%(act_product_stock_move_open)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" groups="stock.group_stock_user" icon="fa-arrows-v"/> <button class="oe_inline oe_stat_button" name="%(product_open_orderpoint)d" type="action" attrs="{'invisible':[('type', '=', 'service')]}" icon="fa-pinterest" string="Reordering Rules"/> </xpath> </field> </record> </data> -</openerp>
\ No newline at end of file +</openerp> diff --git a/addons/stock/security/stock_security.xml b/addons/stock/security/stock_security.xml index 976e83545bd..f44d354f121 100644 --- a/addons/stock/security/stock_security.xml +++ b/addons/stock/security/stock_security.xml @@ -49,6 +49,15 @@ <field name="global" eval="True"/> <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> </record> + + <record model="ir.rule" id="stock_picking_rule"> + <field name="name">Stock Picking Type multi-company</field> + <field name="model_id" search="[('model','=','stock.picking.type')]" model="ir.model"/> + <field name="global" eval="True"/> + <field name="domain_force">['|', ('warehouse_id', '=', False), '|',('warehouse_id.company_id','=',False),('warehouse_id.company_id','child_of',[user.company_id.id])]</field> + </record> + + <record model="ir.rule" id="stock_warehouse_comp_rule"> <field name="name">Warehouse multi-company</field> diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 774985ed3ac..e640c6daec4 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -29,6 +29,7 @@ from openerp.tools.translate import _ from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT from openerp import SUPERUSER_ID import openerp.addons.decimal_precision as dp +from openerp.addons.procurement import procurement import logging @@ -622,6 +623,12 @@ class stock_picking(osv.osv): move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines] move_obj.write(cr, uid, move_ids, {'date_expected': value}, context=context) + def _set_priority(self, cr, uid, id, field, value, arg, context=None): + move_obj = self.pool.get("stock.move") + if value: + move_ids = [move.id for move in self.browse(cr, uid, id, context=context).move_lines] + move_obj.write(cr, uid, move_ids, {'priority': value}, context=context) + def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None): """ Finds minimum and maximum dates for picking. @return: Dictionary of values @@ -634,16 +641,18 @@ class stock_picking(osv.osv): cr.execute("""select picking_id, min(date_expected), - max(date_expected) + max(date_expected), + max(priority) from stock_move where picking_id IN %s group by picking_id""", (tuple(ids),)) - for pick, dt1, dt2 in cr.fetchall(): + for pick, dt1, dt2, prio in cr.fetchall(): res[pick]['min_date'] = dt1 res[pick]['max_date'] = dt2 + res[pick]['priority'] = prio return res def create(self, cr, user, vals, context=None): @@ -759,7 +768,9 @@ class stock_picking(osv.osv): * Transferred: has been processed, can't be modified or cancelled anymore\n * Cancelled: has been cancelled, can't be confirmed anymore""" ), - 'priority': fields.selection([('0', 'Low'), ('1', 'Normal'), ('2', 'High')], states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Priority', required=True), + 'priority': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_priority, type='selection', selection=procurement.PROCUREMENT_PRIORITIES, string='Priority', + store={'stock.move': (_get_pickings, ['priority'], 20)}, states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, select=1, help="Priority for this picking. Setting manually a value here would set it as priority for all the moves", + track_visibility='onchange', required=True), 'min_date': fields.function(get_min_max_date, multi="min_max_date", fnct_inv=_set_min_date, store={'stock.move': (_get_pickings, ['date_expected'], 20)}, type='datetime', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}, string='Scheduled Date', select=1, help="Scheduled time for the first part of the shipment to be processed. Setting manually a value here would set it as expected date for all the stock moves.", track_visibility='onchange'), 'max_date': fields.function(get_min_max_date, multi="min_max_date", @@ -1591,7 +1602,7 @@ class stock_move(osv.osv): _columns = { 'name': fields.char('Description', required=True, select=True), - 'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'), + 'priority': fields.selection(procurement.PROCUREMENT_PRIORITIES, 'Priority'), 'create_date': fields.datetime('Creation Date', readonly=True, select=True), 'date': fields.datetime('Date', required=True, select=True, help="Move date: scheduled date until move is done, then date of actual move processing", states={'done': [('readonly', True)]}), 'date_expected': fields.datetime('Expected Date', states={'done': [('readonly', True)]}, required=True, select=True, help="Scheduled date for the processing of this move"), @@ -1628,7 +1639,6 @@ class stock_move(osv.osv): 'move_orig_ids': fields.one2many('stock.move', 'move_dest_id', 'Original Move', help="Optional: previous stock move when chaining them", select=True), 'picking_id': fields.many2one('stock.picking', 'Reference', select=True, states={'done': [('readonly', True)]}), - 'picking_priority': fields.related('picking_id', 'priority', type='selection', selection=[('0', 'Low'), ('1', 'Normal'), ('2', 'High')], string='Picking Priority', store={'stock.picking': (_get_move_ids, ['priority'], 10)}), 'note': fields.text('Notes'), 'state': fields.selection([('draft', 'New'), ('cancel', 'Cancelled'), @@ -1774,6 +1784,7 @@ class stock_move(osv.osv): 'group_id': group_id, 'route_ids': [(4, x.id) for x in move.route_ids], 'warehouse_id': move.warehouse_id and move.warehouse_id.id or False, + 'priority': move.priority, } def _push_apply(self, cr, uid, moves, context=None): @@ -1981,7 +1992,7 @@ class stock_move(osv.osv): values = { 'origin': move.origin, 'company_id': move.company_id and move.company_id.id or False, - 'move_type': move.group_id and move.group_id.move_type or 'one', + 'move_type': move.group_id and move.group_id.move_type or 'direct', 'partner_id': move.partner_id.id or False, 'picking_type_id': move.picking_type_id and move.picking_type_id.id or False, } @@ -2743,7 +2754,7 @@ class stock_warehouse(osv.osv): _columns = { 'name': fields.char('Warehouse Name', size=128, required=True, select=True), - 'company_id': fields.many2one('res.company', 'Company', required=True, select=True), + 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, select=True), 'partner_id': fields.many2one('res.partner', 'Address'), 'view_location_id': fields.many2one('stock.location', 'View Location', required=True, domain=[('usage', '=', 'view')]), 'lot_stock_id': fields.many2one('stock.location', 'Location Stock', required=True, domain=[('usage', '=', 'internal')]), @@ -3615,19 +3626,11 @@ class stock_package(osv.osv): return True def action_print(self, cr, uid, ids, context=None): - if context is None: - context = {} - datas = { - 'ids': context.get('active_id') and [context.get('active_id')] or ids, - 'model': 'stock.quant.package', - 'form': self.read(cr, uid, ids)[0] - } - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'stock.quant.package.barcode', - 'datas': datas - } - + context = context or {} + context['active_ids'] = ids + return self.pool.get("report").get_action(cr, uid, ids, 'stock.report_package_barcode', context=context) + + def unpack(self, cr, uid, ids, context=None): quant_obj = self.pool.get('stock.quant') for package in self.browse(cr, uid, ids, context=context): diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml index f5c98068ef9..e88aa04a9cc 100644 --- a/addons/stock/stock_report.xml +++ b/addons/stock/stock_report.xml @@ -20,6 +20,7 @@ /> <report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Stock Level Forecast"/> <report id="action_report_quant_package_barcode" model="stock.quant.package" report_type="qweb-pdf" name="stock.report_package_barcode" string="Package BarCode" file="stock.report_package_barcode"/> - + <report id="action_report_location_barcode" model="stock.location" report_type="qweb-pdf" name="stock.report_location_barcode" string="Location BarCode" file="stock.report_location_barcode"/> + <report id="action_report_lot_barcode" model="stock.production.lot" report_type="qweb-pdf" name="stock.report_lot_barcode" string="Lot BarCode" file="stock.report_lot_barcode"/> </data> </openerp> diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 1daa342f5f3..697f566a732 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -365,7 +365,10 @@ <field name="arch" type="xml"> <form string="Stock Location" version="7.0"> <div class="oe_right oe_button_box" name="buttons"> - <button string="Current Stock" name="%(location_open_quants)d" type="action"/> + <button string="Current Stock" + class="oe_stat_button" + icon="fa-building-o" name="%(location_open_quants)d" type="action" + context="{'search_default_internal_loc': 1}"/> </div> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -560,7 +563,11 @@ <form string="Warehouse" version="7.0"> <sheet> <div class="oe_right oe_button_box"> - <button name="view_all_routes_for_wh" string="View Warehouse Routes" type="object"/> + <button name="view_all_routes_for_wh" + string="Routes" + icon="fa-refresh" + class="oe_stat_button" + type="object"/> </div> <label for="name" class="oe_edit_only"/> <h1><field name="name"/></h1> @@ -744,6 +751,21 @@ <field name="pack_operation_exist" invisible="1"/> <field name="note" placeholder="Add an internal note..." class="oe_inline"/> </page> + <page string="Operations Done" attrs="{'invisible': ['|', ('state','!=','done'), ('pack_operation_ids','=',[])]}"> + <field name="pack_operation_ids"> + <tree editable="top"> + <field name="location_id"/> + <field name="product_id"/> + <field name="product_uom_id" groups="product.group_uom"/> + <field name="lot_id" domain="[('product_id','=?', product_id)]" context="{'product_id': product_id}" groups="stock.group_production_lot"/> + <field name="package_id" groups="stock.group_tracking_lot"/> + <field name="owner_id" groups="stock.group_tracking_owner"/> + <field name="product_qty" attrs="{'required': [('product_id', '!=', False)]}"/> + <field name="location_dest_id"/> + <field name="result_package_id" groups="stock.group_tracking_lot"/> + </tree> + </field> + </page> <page string="Additional Info"> <group string="General Informations"> <group> @@ -1058,7 +1080,7 @@ </group> <group name="main_grp_col2"> <field name="picking_type_id"/> - <field name="picking_priority"/> + <field name="priority"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/> <field name="date_expected" on_change="onchange_date(date,date_expected)" attrs="{'invisible': [('state', '=', 'done')]}"/> <field name="date" attrs="{'invisible': [('state', '!=', 'done')]}"/> @@ -1769,7 +1791,7 @@ <field name="res_model">stock.warehouse.orderpoint</field> </record> <record model="ir.actions.act_window" id="product_open_quants"> - <field name="context">{'search_default_product_id': active_id, 'search_default_locationgroup':1}</field> + <field name="context">{'search_default_internal_loc': 1, 'search_default_product_id': active_id, 'search_default_locationgroup':1}</field> <field name="name">Quants</field> <field name="res_model">stock.quant</field> </record> diff --git a/addons/stock/views/report_location_barcode.xml b/addons/stock/views/report_location_barcode.xml new file mode 100644 index 00000000000..d9065e0d207 --- /dev/null +++ b/addons/stock/views/report_location_barcode.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_location_barcode"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t> + <div class="page"> + <div class="oe_structure"/> + <div class="row"> + <div class="col-xs-4"> + <img class="image" t-att-src="'data:image/png;base64,%s' % res_company.logo" style="border:auto;"/> + </div> + </div> + <div class="row"> + <div class="col-xs-6 mt6"> + <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table> + <img t-if="not o.loc_barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.name, 600, 100)" style="width:300px;height:50px"/> + <img t-if="o.loc_barcode" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.loc_barcode, 600, 100)" style="width:300px;height:50px"/> + <p class="text-center" t-if="not o.loc_barcode" t-field="o.name"></p> + <p class="text-center" t-if="o.loc_barcode" t-field="o.loc_barcode"></p> + </div> + </div> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp>
\ No newline at end of file diff --git a/addons/stock/views/report_lot_barcode.xml b/addons/stock/views/report_lot_barcode.xml new file mode 100644 index 00000000000..e89f51e2a0a --- /dev/null +++ b/addons/stock/views/report_lot_barcode.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> +<data> +<template id="report_lot_barcode"> + <t t-call="report.html_container"> + <t t-foreach="docs" t-as="o"> + <t> + <div class="page"> + <div class="oe_structure"/> + <div class="row"> + <div class="col-xs-8"> + <table class="table table-condensed" style="border-bottom: 0px solid white !important;"> + <thead> + <tr> + <th>Product</th> + <th>Lot</th> + </tr> + </thead> + <tbody> + <td> + <span t-field="o.product_id.name"/> + </td> + <td> + <span t-field="o.name"/> + </td> + </tbody> + </table> + </div> + <div class="col-xs-4"> + <img class="image" t-att-src="'data:image/png;base64,%s' % res_company.logo" style="border:auto;"/> + </div> + </div> + <div class="row"> + <div class="col-xs-12 mt32"> + <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.name, 600, 100)" style="width:300px;height:50px"/> + <p class="text-center" t-field="o.name"></p> + </div> + </div> + </div> + </t> + </t> + </t> +</template> +</data> +</openerp>
\ No newline at end of file diff --git a/addons/stock/views/report_package_barcode.xml b/addons/stock/views/report_package_barcode.xml index 841486e8293..330dcd97bd4 100644 --- a/addons/stock/views/report_package_barcode.xml +++ b/addons/stock/views/report_package_barcode.xml @@ -40,7 +40,7 @@ <div class="row"> <div class="col-xs-12 mt32"> <table class="table table-condensed" style="border-bottom: 3px solid black !important;"><thead><th> </th></thead></table> - <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Standard39', o.name, 800, 40)" style="width:100%;"/> + <img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('Code128', o.name, 600, 100)" style="width:300px;height:50px"/> <p class="text-center" t-field="o.name"></p> </div> </div> diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml index 1328cb78c05..0b67ba94db6 100644 --- a/addons/stock/views/report_stockpicking.xml +++ b/addons/stock/views/report_stockpicking.xml @@ -7,7 +7,7 @@ <t t-call="report.external_layout"> <div class="page"> <div class="row"><div class="col-xs-4 pull-right"> - <img t-att-src="'/report/barcode/Standard39/%s' % o.name"/> + <img t-att-src="'/report/barcode/Code128/%s' % o.name"/> </div></div> <div t-if="o.picking_type_id.code=='incoming'"> <span><strong>Supplier Address:</strong></span> @@ -104,13 +104,13 @@ </t> <td> <span t-if="pack_operation.lot_id"> - <img t-att-src="'/report/barcode/Standard39/%s' % pack_operation.lot_id.name"/> + <img t-att-src="'/report/barcode/Code128/%s' % pack_operation.lot_id.name"/> </span> <span t-if="pack_operation.product_id and not pack_operation.lot_id and pack_operation.product_id.ean13"> <img t-att-src="'/report/barcode/EAN13/%s' % pack_operation.product_id.ean13"/> </span> <span t-if="pack_operation.package_id and not pack_operation.product_id"> - <img t-att-src="'/report/barcode/Standard39/%s' % pack_operation.package_id.name"/> + <img t-att-src="'/report/barcode/Code128/%s' % pack_operation.package_id.name"/> </span> </td> <t t-if="o.picking_type_id.code != 'outgoing'"><td><span t-field="pack_operation.location_dest_id"/> diff --git a/addons/stock_account/security/stock_account_security.xml b/addons/stock_account/security/stock_account_security.xml index 97ecaecd278..7c30c4ab08d 100644 --- a/addons/stock_account/security/stock_account_security.xml +++ b/addons/stock_account/security/stock_account_security.xml @@ -8,6 +8,15 @@ <field name="name">Manage Inventory Valuation and Costing Methods</field> <field name="category_id" ref="base.module_category_hidden"/> </record> + + + <record model="ir.rule" id="stock_history_rule"> + <field name="name">Stock History multi-company</field> + <field name="model_id" search="[('model','=','stock.history')]" model="ir.model"/> + <field name="global" eval="True"/> + <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field> + </record> + </data> </openerp> diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 0d14b82d5f5..461684faf5f 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1041,7 +1041,7 @@ color: black; } .openerp .oe_footer a span { - color: #c81010; + color: #a24689; } .openerp .oe_secondary_menu_section { font-weight: bold; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 100406caf85..4baddd7d862 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -880,7 +880,7 @@ $sheet-padding: 16px font-weight: bold color: black span - color: #c81010 + color: #a24689 // }}} // Webclient.leftbar items {{{ diff --git a/addons/web/static/src/img/favicon.ico b/addons/web/static/src/img/favicon.ico Binary files differindex a323cc21c00..4abb40924b7 100644 --- a/addons/web/static/src/img/favicon.ico +++ b/addons/web/static/src/img/favicon.ico diff --git a/addons/web/static/src/img/logo.png b/addons/web/static/src/img/logo.png Binary files differindex 231cc26379f..a0a79df29fb 100644 --- a/addons/web/static/src/img/logo.png +++ b/addons/web/static/src/img/logo.png diff --git a/addons/web/static/src/img/logo2.png b/addons/web/static/src/img/logo2.png Binary files differindex 6b32937328b..1651b0c94a8 100644 --- a/addons/web/static/src/img/logo2.png +++ b/addons/web/static/src/img/logo2.png diff --git a/addons/web/static/src/img/nologo.png b/addons/web/static/src/img/nologo.png Binary files differindex 36ff0e1d16c..be3cd13a94e 100644 --- a/addons/web/static/src/img/nologo.png +++ b/addons/web/static/src/img/nologo.png diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index a8563818b82..f3de92e0a0f 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -403,8 +403,8 @@ </a> <ul class="dropdown-menu"> <li><a href="#" data-menu="settings">Preferences</a></li> - <li><a href="#" data-menu="account">My OpenERP.com account</a></li> - <li><a href="#" data-menu="about">About OpenERP</a></li> + <li><a href="#" data-menu="account">My Odoo.com account</a></li> + <li><a href="#" data-menu="about">About Odoo</a></li> <li><a href="#" data-menu="help">Help</a></li> <li><a href="#" data-menu="logout">Log out</a></li> </ul> @@ -420,9 +420,9 @@ <div class="oe_bottom"> <p>Copyright © 2004-TODAY OpenERP SA. All Rights Reserved.<br /> - OpenERP is a trademark of the <a target="_blank" href="http://openerp.com/" style="text-decoration: underline;">OpenERP SA Company</a>.</p> + OpenERP is a trademark of the <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">OpenERP SA Company</a>.</p> <p>Licenced under the terms of <a target="_blank" href="http://www.gnu.org/licenses/agpl.html" style="text-decoration: underline;">GNU Affero General Public License</a></p> - <p>For more information visit <a target="_blank" href="http://openerp.com/" style="text-decoration: underline;">OpenERP.com</a></p> + <p>For more information visit <a target="_blank" href="https://www.odoo.com" style="text-decoration: underline;">Odoo.com</a></p> </div> </div> @@ -448,7 +448,7 @@ </a> <div class="oe_secondary_menus_container"/> <div class="oe_footer"> - Powered by <a href="http://www.openerp.com" target="_blank"><span>OpenERP</span></a> + Powered by <a href="http://www.odoo.com" target="_blank"><span>Odoo</span></a> </div> </div> </td> diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 446080875a6..0a2a5ed1397 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -245,7 +245,7 @@ class Website(openerp.addons.web.controllers.main.Home): @http.route('/website/get_view_translations', type='json', auth='public', website=True) def get_view_translations(self, xml_id, lang=None): lang = lang or request.context.get('lang') - views = self.customize_template_get(xml_id, optional=False) + views = self.customize_template_get(xml_id, full=True) views_ids = [view.get('id') for view in views if view.get('active')] domain = [('type', '=', 'view'), ('res_id', 'in', views_ids), ('lang', '=', lang)] irt = request.registry.get('ir.translation') diff --git a/addons/website/models/ir_ui_view.py b/addons/website/models/ir_ui_view.py index 398bbb6a87b..c94281a4487 100644 --- a/addons/website/models/ir_ui_view.py +++ b/addons/website/models/ir_ui_view.py @@ -6,6 +6,7 @@ import werkzeug from lxml import etree, html +from openerp import SUPERUSER_ID from openerp.addons.website.models import website from openerp.http import request from openerp.osv import osv, fields @@ -206,3 +207,7 @@ class view(osv.osv): self.write(cr, uid, res_id, { 'arch': self._pretty_arch(arch) }, context=context) + + view = self.browse(cr, SUPERUSER_ID, res_id, context=context) + if view.model_data_id: + view.model_data_id.write({'noupdate': True}) diff --git a/addons/website_forum/data/badges_moderation.xml b/addons/website_forum/data/badges_moderation.xml index 41f3eb7fe41..8e3c1b3dda7 100644 --- a/addons/website_forum/data/badges_moderation.xml +++ b/addons/website_forum/data/badges_moderation.xml @@ -99,7 +99,7 @@ <field name="domain" eval="[('model', '=', 'forum.post'), ('subtype_id', 'in', [ref('website_forum.mt_answer_edit'), ref('website_forum.mt_question_edit')])]"/> <field name="batch_mode">True</field> <field name="batch_distinctive_field" eval="ref('mail.field_mail_message_author_id')" /> - <field name="batch_user_expression">user.id</field> + <field name="batch_user_expression">user.partner_id.id</field> </record> <record model="gamification.challenge" id="challenge_editor"> <field name="name">Editor</field> diff --git a/addons/website_mail/static/src/img/blocks/button_group_subscribe.png b/addons/website_mail/static/src/img/blocks/button_group_subscribe.png Binary files differnew file mode 100644 index 00000000000..204239a8e0c --- /dev/null +++ b/addons/website_mail/static/src/img/blocks/button_group_subscribe.png diff --git a/addons/website_mail_group/static/src/js/website_mail_group.editor.js b/addons/website_mail_group/static/src/js/website_mail_group.editor.js index 7a26920682b..fdfb948121f 100644 --- a/addons/website_mail_group/static/src/js/website_mail_group.editor.js +++ b/addons/website_mail_group/static/src/js/website_mail_group.editor.js @@ -10,7 +10,7 @@ return website.prompt({ id: "editor_new_subscribe_button", window_title: _t("Add a Subscribe Button"), - select: _t("Mailing List"), + select: _t("Discussion List"), init: function (field) { return website.session.model('mail.group') .call('name_search', ['', [['public','=','public']]], { context: website.get_context() }); diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 3a601e872a3..41d1ebdb6ac 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -716,10 +716,6 @@ class website_sale(http.Controller): return request.redirect("/shop/product/%s?enable_editor=1" % slug(product.product_tmpl_id)) - @http.route(['/shop/reorder'], type='json', auth="public") - def reorder(self, product_id, operation): - request.registry['product.template'].website_reorder(request.cr, request.uid, [id], operation, context=request.context) - @http.route(['/shop/change_styles'], type='json', auth="public") def change_styles(self, id, style_id): product_obj = request.registry.get('product.template') @@ -742,6 +738,18 @@ class website_sale(http.Controller): return not active + @http.route(['/shop/change_sequence'], type='json', auth="public") + def change_sequence(self, id, sequence): + product_obj = request.registry.get('product.template') + if sequence == "top": + product_obj.set_sequence_top(request.cr, request.uid, [id], context=request.context) + elif sequence == "bottom": + product_obj.set_sequence_bottom(request.cr, request.uid, [id], context=request.context) + elif sequence == "up": + product_obj.set_sequence_up(request.cr, request.uid, [id], context=request.context) + elif sequence == "down": + product_obj.set_sequence_down(request.cr, request.uid, [id], context=request.context) + @http.route(['/shop/change_size'], type='json', auth="public") def change_size(self, id, x, y): product_obj = request.registry.get('product.template') diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 13f4202a999..93c9ae8036a 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -65,7 +65,7 @@ class product_public_category(osv.osv): for obj in self.browse(cr, uid, ids, context=context): result[obj.id] = tools.image_get_resized_images(obj.image) return result - + def _set_image(self, cr, uid, id, name, value, args, context=None): return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context) @@ -75,7 +75,7 @@ class product_public_category(osv.osv): 'parent_id': fields.many2one('product.public.category','Parent Category', select=True), 'child_id': fields.one2many('product.public.category', 'parent_id', string='Children Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), - + # NOTE: there is no 'default image', because by default we don't show thumbnails for categories. However if we have a thumbnail # for at least one category, then we display a default image on the other, so that the buttons have consistent styling. # In this case, the default image is set by the js code. @@ -153,34 +153,37 @@ class product_template(osv.Model): 'website_published': False, } - def website_reorder(self, cr, uid, ids, operation=None, context=None): - if operation == "top": - cr.execute('SELECT MAX(website_sequence) FROM product_template') - seq = (cr.fetchone()[0] or 0) + 1 - if operation == "bottom": - cr.execute('SELECT MIN(website_sequence) FROM product_template') - seq = (cr.fetchone()[0] or 0) -1 - if operation == "up": - product = self.browse(cr, uid, ids[0], context=context) - cr.execute(""" SELECT id, website_sequence FROM product_template - WHERE website_sequence > %s AND website_published = %s ORDER BY website_sequence ASC LIMIT 1""" % (product.website_sequence, product.website_published)) - prev = cr.fetchone() - if prev: - self.write(cr, uid, [prev[0]], {'website_sequence': product.website_sequence}, context=context) - return self.write(cr, uid, [ids[0]], {'website_sequence': prev[1]}, context=context) - else: - return self.website_reorder(cr, uid, ids, operation='top', context=context) - if operation == "down": - product = self.browse(cr, uid, ids[0], context=context) - cr.execute(""" SELECT id, website_sequence FROM product_template - WHERE website_sequence < %s AND website_published = %s ORDER BY website_sequence DESC LIMIT 1""" % (product.website_sequence, product.website_published)) - next = cr.fetchone() - if next: - self.write(cr, uid, [next[0]], {'website_sequence': product.website_sequence}, context=context) - return self.write(cr, uid, [ids[0]], {'website_sequence': next[1]}, context=context) - else: - return self.website_reorder(cr, uid, ids, operation='bottom', context=context) - return self.write(cr, uid, ids, {'website_sequence': seq}, context=context) + def set_sequence_top(self, cr, uid, ids, context=None): + cr.execute('SELECT MAX(website_sequence) FROM product_template') + max_sequence = cr.fetchone()[0] or 0 + return self.write(cr, uid, ids, {'website_sequence': max_sequence + 1}, context=context) + + def set_sequence_bottom(self, cr, uid, ids, context=None): + cr.execute('SELECT MIN(website_sequence) FROM product_template') + min_sequence = cr.fetchone()[0] or 0 + return self.write(cr, uid, ids, {'website_sequence': min_sequence -1}, context=context) + + def set_sequence_up(self, cr, uid, ids, context=None): + product = self.browse(cr, uid, ids[0], context=context) + cr.execute(""" SELECT id, website_sequence FROM product_template + WHERE website_sequence > %s AND website_published = %s ORDER BY website_sequence ASC LIMIT 1""" % (product.website_sequence, product.website_published)) + prev = cr.fetchone() + if prev: + self.write(cr, uid, [prev[0]], {'website_sequence': product.website_sequence}, context=context) + return self.write(cr, uid, [ids[0]], {'website_sequence': prev[1]}, context=context) + else: + return self.set_sequence_top(cr, uid, ids, context=context) + + def set_sequence_down(self, cr, uid, ids, context=None): + product = self.browse(cr, uid, ids[0], context=context) + cr.execute(""" SELECT id, website_sequence FROM product_template + WHERE website_sequence < %s AND website_published = %s ORDER BY website_sequence DESC LIMIT 1""" % (product.website_sequence, product.website_published)) + next = cr.fetchone() + if next: + self.write(cr, uid, [next[0]], {'website_sequence': product.website_sequence}, context=context) + return self.write(cr, uid, [ids[0]], {'website_sequence': next[1]}, context=context) + else: + return self.set_sequence_bottom(cr, uid, ids, context=context) def img(self, cr, uid, ids, field='image_small', context=None): return "/website/image?model=%s&field=%s&id=%s" % (self._name, field, ids[0]) diff --git a/openerp/addons/base/static/img/main_partner-image.png b/openerp/addons/base/static/img/main_partner-image.png Binary files differindex 8f1c5c6085f..1651b0c94a8 100644 --- a/openerp/addons/base/static/img/main_partner-image.png +++ b/openerp/addons/base/static/img/main_partner-image.png |
