diff --git a/addons/board/static/src/css/dashboard.css b/addons/board/static/src/css/dashboard.css index ed66e338c81..f2bbcd07071 100644 --- a/addons/board/static/src/css/dashboard.css +++ b/addons/board/static/src/css/dashboard.css @@ -1,3 +1,36 @@ +.openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_0 { + width: 100%; +} +.openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_1, .openerp .oe_dashboard_layout_1 .oe_dashboard_column.index_2 { + display: none; +} +.openerp .oe_dashboard_layout_1-1 .oe_dashboard_column { + width: 50%; +} +.openerp .oe_dashboard_layout_1-1 .oe_dashboard_column.index_2 { + display: none; +} +.openerp .oe_dashboard_layout_1-1-1 .oe_dashboard_column { + width: 33%; +} +.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_0 { + width: 70%; +} +.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_1 { + width: 30%; +} +.openerp .oe_dashboard_layout_2-1 .oe_dashboard_column.index_2 { + display: none; +} +.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_0 { + width: 30%; +} +.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_1 { + width: 70%; +} +.openerp .oe_dashboard_layout_1-2 .oe_dashboard_column.index_2 { + display: none; +} .openerp .oe_dashboard_layout_selector ul { white-space: nowrap; } diff --git a/addons/board/static/src/css/dashboard.sass b/addons/board/static/src/css/dashboard.sass index 32f0e3b4f3a..122b6dc232c 100644 --- a/addons/board/static/src/css/dashboard.sass +++ b/addons/board/static/src/css/dashboard.sass @@ -9,6 +9,31 @@ box-shadow: $bsval .openerp + .oe_dashboard_layout_1 .oe_dashboard_column + &.index_0 + width: 100% + &.index_1, &.index_2 + display: none + .oe_dashboard_layout_1-1 .oe_dashboard_column + width: 50% + &.index_2 + display: none + .oe_dashboard_layout_1-1-1 .oe_dashboard_column + width: 33% + .oe_dashboard_layout_2-1 .oe_dashboard_column + &.index_0 + width: 70% + &.index_1 + width: 30% + &.index_2 + display: none + .oe_dashboard_layout_1-2 .oe_dashboard_column + &.index_0 + width: 30% + &.index_1 + width: 70% + &.index_2 + display: none .oe_dashboard_layout_selector ul white-space: nowrap @@ -98,3 +123,4 @@ > tbody tr:nth-child(odd) background: transparent + diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 9c37924144d..43d7ca76d39 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -24,6 +24,10 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ scroll: false }).bind('sortstop', self.do_save_dashboard); + var old_title = this.__parentedParent.get('title'); + this.__parentedParent.on_record_loaded.add_last(function(){ + self.__parentedParent.set({ 'title' : old_title}); + }); // Events this.$el.find('.oe_dashboard_link_reset').click(this.on_reset); this.$el.find('.oe_dashboard_link_change_layout').click(this.on_change_layout); @@ -165,8 +169,6 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ this.rpc('/web/view/add_custom', { view_id: this.view.fields_view.view_id, arch: arch - }, function() { - self.$el.find('.oe_dashboard_link_reset').show(); }); }, on_load_action: function(result, index, action_attrs) { diff --git a/addons/board/static/src/xml/board.xml b/addons/board/static/src/xml/board.xml index e13fa707776..03ede793036 100644 --- a/addons/board/static/src/xml/board.xml +++ b/addons/board/static/src/xml/board.xml @@ -1,7 +1,7 @@ diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index 1fab5dd1732..57a59e2595f 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -647,3 +647,33 @@ class test_mail(TestMailMockups): msg1.refresh() self.assertEqual(5, len(group_pigs.message_ids), 'group should contain 5 messages') self.assertEqual(2, len(msg1.child_ids), 'msg1 should have 2 children now') + + def test_60_vote(self): + """ Test designed for the vote/unvote feature. """ + cr, uid = self.cr, self.uid + group_pigs = self.mail_group.browse(cr, uid, self.group_pigs_id) + user_admin = self.res_users.browse(cr, uid, uid) + msg1 = group_pigs.message_post(body='My Body', subject='1') + msg1 = self.mail_message.browse(cr, uid, msg1) + + # Create user Bert Tartopoils + user_bert_id = self.res_users.create(cr, uid, {'name': 'Bert', 'login': 'bert'}) + user_bert = self.res_users.browse(cr, uid, user_bert_id) + + # Test: msg1 and msg2 have void vote_user_ids + self.assertFalse(msg1.vote_user_ids, 'newly created message msg1 has not void vote_user_ids') + # Do: Admin vote for msg1 + self.mail_message.vote_toggle(cr, uid, [msg1.id]) + msg1.refresh() + # Test: msg1 has Admin as voter + self.assertEqual(set(msg1.vote_user_ids), set([user_admin]), 'after voting, Admin is not the voter') + # Do: Bert vote for msg1 + self.mail_message.vote_toggle(cr, uid, [msg1.id], [user_bert_id]) + msg1.refresh() + # Test: msg1 has Admin and Bert as voters + self.assertEqual(set(msg1.vote_user_ids), set([user_admin, user_bert]), 'after voting, Admin and Bert are not the voters') + # Do: Admin unvote for msg1 + self.mail_message.vote_toggle(cr, uid, [msg1.id]) + msg1.refresh() + # Test: msg1 has Bert as voter + self.assertEqual(set(msg1.vote_user_ids), set([user_bert]), 'after unvoting for Admin, Bert is not the voter') diff --git a/addons/mrp/board_manufacturing_view.xml b/addons/mrp/board_manufacturing_view.xml index cae1fea07dc..6bd07c2648b 100644 --- a/addons/mrp/board_manufacturing_view.xml +++ b/addons/mrp/board_manufacturing_view.xml @@ -30,7 +30,8 @@ icon="terp-graph" id="menu_board_manufacturing" parent="base.menu_reporting_dashboard" - sequence="30"/> + sequence="30" + groups="group_mrp_manager"/> diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index ec1dc4b26fb..842f9ec27fa 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -554,7 +554,7 @@ class stock_warehouse_orderpoint(osv.osv): 'logic': fields.selection([('max','Order to Max'),('price','Best price (not yet active!)')], 'Reordering Mode', required=True), 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True, ondelete="cascade"), 'location_id': fields.many2one('stock.location', 'Location', required=True, ondelete="cascade"), - 'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','=','product')]), + 'product_id': fields.many2one('product.product', 'Product', required=True, ondelete='cascade', domain=[('type','!=','service')]), 'product_uom': fields.many2one('product.uom', 'Product Unit of Measure', required=True), 'product_min_qty': fields.float('Minimum Quantity', required=True, help="When the virtual stock goes below the Min Quantity specified for this field, OpenERP generates "\ diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 1f6279af3ad..e982930d69e 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -548,6 +548,7 @@ class purchase_order(osv.osv): 'partner_id': order.dest_address_id.id or order.partner_id.id, 'move_dest_id': order_line.move_dest_id.id, 'state': 'draft', + 'type':'in', 'purchase_line_id': order_line.id, 'company_id': order.company_id.id, 'price_unit': order_line.price_unit diff --git a/addons/purchase/stock_view.xml b/addons/purchase/stock_view.xml index b522618ed2e..21c52b4d2ec 100644 --- a/addons/purchase/stock_view.xml +++ b/addons/purchase/stock_view.xml @@ -31,7 +31,7 @@ - + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index c288d4fc67e..0d4bda344a5 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -145,6 +145,14 @@ class sale_order(osv.osv): res[sale.id] = 0.0 return res + def _invoice_exists(self, cursor, user, ids, name, arg, context=None): + res = {} + for sale in self.browse(cursor, user, ids, context=context): + res[sale.id] = False + if sale.invoice_ids: + res[sale.id] = True + return res + def _invoiced(self, cursor, user, ids, name, arg, context=None): res = {} for sale in self.browse(cursor, user, ids, context=context): @@ -156,7 +164,7 @@ class sale_order(osv.osv): if invoice.state != 'paid': res[sale.id] = False break - if not invoice_existence: + if not invoice_existence or sale.state == 'manual': res[sale.id] = False return res @@ -245,6 +253,8 @@ class sale_order(osv.osv): 'invoiced_rate': fields.function(_invoiced_rate, string='Invoiced', type='float'), 'invoiced': fields.function(_invoiced, string='Paid', fnct_search=_invoiced_search, type='boolean', help="It indicates that an invoice has been paid."), + 'invoice_exists': fields.function(_invoice_exists, string='Invoiced', + fnct_search=_invoiced_search, type='boolean', help="It indicates that sale order has at least one invoice."), 'note': fields.text('Terms and conditions'), 'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount', @@ -518,68 +528,45 @@ class sale_order(osv.osv): This function returns an action that display existing invoices of given sale order ids. It can either be a in a list or in a form view, if there is only one invoice to show. ''' mod_obj = self.pool.get('ir.model.data') - result = { - 'name': _('Cutomer Invoice'), - 'view_type': 'form', - 'res_model': 'account.invoice', - 'context': "{'type':'out_invoice', 'journal_type': 'sale'}", - 'type': 'ir.actions.act_window', - 'nodestroy': True, - 'target': 'current', - } + act_obj = self.pool.get('ir.actions.act_window') + + result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree1') + id = result and result[1] or False + result = act_obj.read(cr, uid, [id], context=context)[0] #compute the number of invoices to display inv_ids = [] for so in self.browse(cr, uid, ids, context=context): inv_ids += [invoice.id for invoice in so.invoice_ids] #choose the view_mode accordingly if len(inv_ids)>1: - res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_tree') - result.update({ - 'view_mode': 'tree,form', - 'res_id': inv_ids or False - }) + result['domain'] = "[('id','in',["+','.join(map(str, inv_ids))+"])]" else: res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form') - result.update({ - 'view_mode': 'form', - 'res_id': inv_ids and inv_ids[0] or False, - }) - result.update(view_id = res and res[1] or False) + result['views'] = [(res and res[1] or False, 'form')] + result['res_id'] = inv_ids and inv_ids[0] or False return result - def action_view_delivery(self, cr, uid, ids, context=None): ''' This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show. ''' mod_obj = self.pool.get('ir.model.data') - result = { - 'name': _('Delivery Order'), - 'view_type': 'form', - 'res_model': 'stock.picking', - 'context': "{'type':'out'}", - 'type': 'ir.actions.act_window', - 'nodestroy': True, - 'target': 'current', - } + act_obj = self.pool.get('ir.actions.act_window') + + result = mod_obj.get_object_reference(cr, uid, 'stock', 'action_picking_tree') + id = result and result[1] or False + result = act_obj.read(cr, uid, [id], context=context)[0] #compute the number of delivery orders to display pick_ids = [] for so in self.browse(cr, uid, ids, context=context): pick_ids += [picking.id for picking in so.picking_ids] #choose the view_mode accordingly if len(pick_ids) > 1: - res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_tree') - result.update({ - 'view_mode': 'tree,form', - 'res_id': pick_ids or False - }) + result['domain'] = "[('id','in',["+','.join(map(str, pick_ids))+"])]" else: res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form') - result.update({ - 'view_mode': 'form', - 'res_id': pick_ids and pick_ids[0] or False, - }) - result.update(view_id = res and res[1] or False) + result['views'] = [(res and res[1] or False, 'form')] + result['res_id'] = pick_ids and pick_ids[0] or False return result def test_no_product(self, cr, uid, order, context): @@ -883,6 +870,7 @@ class sale_order(osv.osv): 'sale_line_id': line.id, 'tracking_id': False, 'state': 'draft', + 'type':'out', #'state': 'waiting', 'note': '\n'.join(line.name.split('\n')[1:]), 'company_id': order.company_id.id, diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 651454ef73d..5c2320a7d5c 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -163,7 +163,7 @@