diff options
| author | Denis Ledoux <dle@odoo.com> | 2015-04-27 12:19:43 +0200 |
|---|---|---|
| committer | Denis Ledoux <dle@odoo.com> | 2015-04-27 12:19:43 +0200 |
| commit | d6ae7fb7dbd2ae4eec32e4cd5bc3649feef0784e (patch) | |
| tree | 59ce4e3e7cc67695b8a84c030bf428076d7c809e /addons | |
| parent | 9323f2b4c75d61a4169efceabac08e09f03d6062 (diff) | |
| parent | 3e7d3c7ee4f8838e0a9c347eca016e746175a634 (diff) | |
[MERGE] forward port of branch 7.0 up to 3e7d3c7
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/account.py | 2 | ||||
| -rw-r--r-- | addons/account_payment/wizard/account_payment_populate_statement.py | 1 | ||||
| -rw-r--r-- | addons/crm/calendar_event_menu.xml | 11 | ||||
| -rw-r--r-- | addons/crm/crm_lead.py | 1 | ||||
| -rw-r--r-- | addons/crm/crm_lead_view.xml | 2 | ||||
| -rw-r--r-- | addons/document/document.py | 7 | ||||
| -rw-r--r-- | addons/event/event_view.xml | 2 | ||||
| -rw-r--r-- | addons/membership/membership_view.xml | 2 | ||||
| -rw-r--r-- | addons/point_of_sale/point_of_sale_view.xml | 2 | ||||
| -rw-r--r-- | addons/portal/wizard/share_wizard.py | 30 | ||||
| -rw-r--r-- | addons/project/project.py | 11 | ||||
| -rw-r--r-- | addons/purchase/purchase.py | 10 | ||||
| -rw-r--r-- | addons/stock/stock.py | 6 | ||||
| -rw-r--r-- | addons/stock/stock_view.xml | 2 |
14 files changed, 68 insertions, 21 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index 7c84a164b9c..ddd6d95ca0a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1753,7 +1753,7 @@ class account_tax_code(osv.osv): res2 = {} for record in self.browse(cr, uid, ids, context=context): def _rec_get(record): - amount = res.get(record.id, 0.0) + amount = res.get(record.id) or 0.0 for rec in record.child_ids: amount += _rec_get(rec) * rec.sign return amount diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 92b1b1452f5..d85f20d8637 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -92,6 +92,7 @@ class account_payment_populate_statement(osv.osv_memory): 'date': line.date or time.strftime('%Y-%m-%d'), 'amount': abs(amount), 'period_id': statement.period_id.id, + 'payment_rate_currency_id': statement.currency.id, } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) diff --git a/addons/crm/calendar_event_menu.xml b/addons/crm/calendar_event_menu.xml index aec88a5748e..66c1119727f 100644 --- a/addons/crm/calendar_event_menu.xml +++ b/addons/crm/calendar_event_menu.xml @@ -5,5 +5,16 @@ <menuitem name="Import & Synchronize" id="base.menu_import_crm" parent="base.menu_base_partner"/> + <record id="view_crm_meeting_search" model="ir.ui.view"> + <field name="name">CRM - Meetings Search</field> + <field name="model">crm.meeting</field> + <field name="inherit_id" ref="base_calendar.view_crm_meeting_search"/> + <field name="arch" type="xml"> + <xpath expr="//field[@name='user_id']" position="after"> + <field name="opportunity_id"/> + </xpath> + </field> + </record> + </data> </openerp> diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index c00df49bb20..42956043aba 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -919,6 +919,7 @@ class crm_lead(format_address, osv.osv): opportunity = self.browse(cr, uid, ids[0], context) res = self.pool.get('ir.actions.act_window').for_xml_id(cr, uid, 'calendar', 'action_calendar_event', context) res['context'] = { + 'search_default_opportunity_id': opportunity.id, 'default_opportunity_id': opportunity.id, 'default_partner_id': opportunity.partner_id and opportunity.partner_id.id or False, 'default_partner_ids' : opportunity.partner_id and [opportunity.partner_id.id] or False, diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 6b23be6b97e..f21e6f88195 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -392,7 +392,7 @@ name="%(opportunity2phonecall_act)d"/> <button string="Meeting" type="object" name="action_makeMeeting" - context="{'search_default_attendee_id': active_id, 'default_attendee_id' : active_id}"/> + type="object" /> </div> <div class="oe_title"> <label for="name" class="oe_edit_only"/> diff --git a/addons/document/document.py b/addons/document/document.py index 238e4562349..e8b708fd706 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -109,8 +109,11 @@ class document_file(osv.osv): ids.extend(parents[parent_id]) # sort result according to the original sort ordering - ids = [id for id in orig_ids if id in ids] - return len(ids) if count else ids + if count: + return len(ids) + else: + set_ids = set(ids) + return [id for id in orig_ids if id in set_ids] def copy(self, cr, uid, id, default=None, context=None): if not default: diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index 07a36ea3a6b..1b5c3cbfe72 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -270,7 +270,7 @@ <separator/> <filter icon="terp-personal" string="My Events" help="My Events" domain="[('user_id','=',uid)]"/> <separator/> - <filter icon="terp-go-today" string="Upcoming" name="upcoming" domain="[('date_begin','>=', time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Upcoming events from today" /> + <filter icon="terp-go-today" string="Upcoming" name="upcoming" domain="[('date_begin','>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Upcoming events from today" /> <field name="type"/> <field name="user_id"/> <group expand="0" string="Group By..."> diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml index 3964b8b07b9..2c1d7a6079a 100644 --- a/addons/membership/membership_view.xml +++ b/addons/membership/membership_view.xml @@ -259,7 +259,7 @@ <field name="date"/> <field name="member_price"/> <field name="membership_id"/> - <field name="account_invoice_id"/> + <field name="account_invoice_id" context="{'form_view_ref': 'account.invoice_form'}"/> <field name="state" colspan="4"/> </form> </field> diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index c93eb536d4c..7871ce724b6 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -952,7 +952,7 @@ <field name="name" /> <filter string="Open" domain="[('state', '=', 'opened')]" /> <separator/> - <filter string="Today" domain="[('start_at', '>=', time.strftime('%%Y-%%m-%%d 00:00:00'))]" /> + <filter string="Today" domain="[('start_at', '>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" /> <field name="config_id" /> <field name="user_id" /> <group expand="0" string="Group By..."> diff --git a/addons/portal/wizard/share_wizard.py b/addons/portal/wizard/share_wizard.py index 0ffae804f07..81fff31a0d0 100644 --- a/addons/portal/wizard/share_wizard.py +++ b/addons/portal/wizard/share_wizard.py @@ -19,12 +19,13 @@ # ############################################################################## +from openerp import SUPERUSER_ID from openerp.osv import fields, osv from openerp.tools.translate import _ import logging _logger = logging.getLogger(__name__) -UID_ROOT = 1 +UID_ROOT = SUPERUSER_ID SHARED_DOCS_MENU = "Documents" SHARED_DOCS_CHILD_MENU = "Shared Documents" @@ -56,9 +57,18 @@ class share_wizard_portal(osv.TransientModel): return super(share_wizard_portal, self)._check_preconditions(cr, uid, wizard_data, context=context) def _create_or_get_submenu_named(self, cr, uid, parent_menu_id, menu_name, context=None): - if not parent_menu_id: - return + if context is None: + context = {} Menus = self.pool.get('ir.ui.menu') + if not parent_menu_id and context.get('group_id'): + cxt = dict(context) + cxt['ir.ui.menu.full_list'] = True + parent_menu_ids = Menus.search(cr, SUPERUSER_ID, + [('groups_id', 'in', [context.get('group_id')]), ('parent_id', '=', False)], limit=1, context=cxt) + parent_menu_id = parent_menu_ids and parent_menu_ids[0] or False + if not parent_menu_id: + return False + parent_menu = Menus.browse(cr, uid, parent_menu_id) # No context menu_id = None max_seq = 10 @@ -79,9 +89,12 @@ class share_wizard_portal(osv.TransientModel): def _sharing_root_menu_id(self, cr, uid, portal, context=None): """Create or retrieve root ID of sharing menu in portal menu - :param portal: browse_record of portal, constructed with a context WITHOUT language + :param portal: browse_record of shared group, constructed with a context WITHOUT language """ - parent_menu_id = self._create_or_get_submenu_named(cr, uid, portal.parent_menu_id.id, SHARED_DOCS_MENU, context=context) + if context is None: + context = {} + ctx = dict(context, group_id=portal.id) + parent_menu_id = self._create_or_get_submenu_named(cr, uid, False, SHARED_DOCS_MENU, context=ctx) if parent_menu_id: child_menu_id = self._create_or_get_submenu_named(cr, uid, parent_menu_id, SHARED_DOCS_CHILD_MENU, context=context) return child_menu_id @@ -90,7 +103,7 @@ class share_wizard_portal(osv.TransientModel): """Create sharing menus in portal menu according to share wizard options. :param wizard_data: browse_record of share.wizard - :param portal: browse_record of portal, constructed with a context WITHOUT language + :param portal: browse_record of shared group, constructed with a context WITHOUT language """ root_menu_id = self._sharing_root_menu_id(cr, uid, portal, context=context) if not root_menu_id: @@ -126,13 +139,16 @@ class share_wizard_portal(osv.TransientModel): # setup the menu for portal groups for group in wizard_data.group_ids: if group.id in all_portal_group_ids: - self._create_shared_data_menu(cr, uid, wizard_data, group.id, context=context) + self._create_shared_data_menu(cr, uid, wizard_data, group, context=context) for user in group.users: new_line = {'user_id': user.id, 'newly_created': False} wizard_data.write({'result_line_ids': [(0,0,new_line)]}) + selected_group_ids = [x.id for x in wizard_data.group_ids] + res_groups.write(cr, SUPERUSER_ID, selected_group_ids, {'implied_ids': [(4, super_result[0])]}) + elif wizard_data.user_ids: # must take care of existing users, by adding them to the new group, which is super_result[0], # and adding the shortcut diff --git a/addons/project/project.py b/addons/project/project.py index 1321defd9c7..d165afc8005 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1103,13 +1103,20 @@ class task(osv.osv): context = context or {} result = "" ident = ' '*ident + company = self.pool["res.users"].browse(cr, uid, uid, context=context).company_id + duration_uom = { + 'day(s)': 'd', 'days': 'd', 'day': 'd', 'd': 'd', + 'month(s)': 'm', 'months': 'm', 'month': 'month', 'm': 'm', + 'week(s)': 'w', 'weeks': 'w', 'week': 'w', 'w': 'w', + 'hour(s)': 'H', 'hours': 'H', 'hour': 'H', 'h': 'H', + }.get(company.project_time_mode_id.name.lower(), "hour(s)") for task in tasks: if task.stage_id and task.stage_id.fold: continue result += ''' %sdef Task_%s(): -%s todo = \"%.2fH\" -%s effort = \"%.2fH\"''' % (ident,task.id, ident,task.remaining_hours, ident,task.total_hours) +%s todo = \"%.2f%s\" +%s effort = \"%.2f%s\"''' % (ident, task.id, ident, task.remaining_hours, duration_uom, ident, task.total_hours, duration_uom) start = [] for t2 in task.parent_ids: start.append("up.Task_%s.end" % (t2.id,)) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index bd273d2779d..a5908cb78ec 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1333,10 +1333,16 @@ class account_invoice(osv.Model): for order in purchase_order_obj.browse(cr, uid, po_ids, context=context): purchase_order_obj.message_post(cr, user_id, order.id, body=_("Invoice received"), context=context) invoiced = [] + shipped = True + # for invoice method manual or order, don't care about shipping state + # for invoices based on incoming shippment, beware of partial deliveries + if (order.invoice_method == 'picking' and + not all(picking.invoice_state in ['invoiced'] for picking in order.picking_ids)): + shipped = False for po_line in order.order_line: - if any(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines): + if all(line.invoice_id.state not in ['draft', 'cancel'] for line in po_line.invoice_lines): invoiced.append(po_line.id) - if invoiced: + if invoiced and shipped: self.pool['purchase.order.line'].write(cr, uid, invoiced, {'invoiced': True}) workflow.trg_write(uid, 'purchase.order', order.id, cr) return res diff --git a/addons/stock/stock.py b/addons/stock/stock.py index e88e11ec012..42ef50220e8 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2707,9 +2707,11 @@ class stock_move(osv.osv): continue partial_data = partial_datas.get('move%s'%(move.id), False) assert partial_data, _('Missing partial picking data for move #%s.') % (move.id) - product_qty = partial_data.get('product_qty',0.0) + product_uom = partial_data.get('product_uom', False) + product_qty = partial_data.get('product_qty', 0.0) + product_qty = self.pool['product.uom']._compute_qty(cr, uid, product_uom, product_qty, move.product_uom.id) move_product_qty[move.id] = product_qty - product_uom = partial_data.get('product_uom',False) + product_price = partial_data.get('product_price',0.0) product_currency = partial_data.get('product_currency',False) prodlot_ids[move.id] = partial_data.get('prodlot_id') diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 89452740ce6..a6514e81421 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1384,7 +1384,7 @@ <filter icon="terp-stock" string="To Do" name="future" domain="[('state','in',('assigned','confirmed','waiting'))]" help="Stock moves that are Confirmed, Available or Waiting"/> <filter icon="terp-dialog-close" string="Done" name="done" domain="[('state','=','done')]" help="Stock moves that have been processed"/> <separator/> - <filter icon="terp-go-today" string="Today" domain="[('date','<=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date','>=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/> + <filter icon="terp-go-today" string="Today" domain="[('date','<=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/> <field name="product_id"/> <field name="name" string="Location" filter_domain="['|',('location_id','ilike',self),('location_dest_id','ilike',self)]"/> <field name="partner_id" string="Partner" filter_domain="[('picking_id.partner_id','child_of',self)]"/> |
