');
- self.$('.oe_pad_readonly').html(data);
- }).fail(function() {
- self.$('.oe_pad_content').text('Unable to load pad');
+ }
+ else {
+ var def = $.when();
+ if (! value || !_.str.startsWith(value, 'http')) {
+ def = self.view.dataset.call('pad_generate_url', {
+ context: {
+ model: self.view.model,
+ field_name: self.name,
+ object_id: self.view.datarecord.id
+ },
+ }).done(function(data) {
+ if (! data.url) {
+ self.set("configured", false);
+ } else {
+ self.set("value", data.url);
+ }
+ });
+ }
+ def.then(function() {
+ value = self.get('value');
+ if (_.str.startsWith(value, 'http')) {
+ var content = '
';
+ self.$('.oe_pad_content').html(content);
+ self._dirty_flag = true;
+ }
+ else {
+ self.$('.oe_pad_content').text(value);
+ }
});
}
- }
+ });
},
});
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index ea43de0152e..9a20047a04d 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -497,10 +497,14 @@ class pos_order(osv.osv):
_description = "Point of Sale"
_order = "id desc"
- def create_from_ui(self, cr, uid, orders, context=None):
- #_logger.info("orders: %r", orders)
+ def create_from_ui(self, cr, uid, orders, context=None):
+ # Keep only new orders
+ submitted_references = [o['data']['name'] for o in orders]
+ existing_orders = self.search_read(cr, uid, domain=[('pos_reference', 'in', submitted_references)], fields=['pos_reference'], context=context)
+ existing_references = set([o['pos_reference'] for o in existing_orders])
+ orders_to_save = [o for o in orders if o['data']['name'] not in existing_references]
order_ids = []
- for tmp_order in orders:
+ for tmp_order in orders_to_save:
to_invoice = tmp_order['to_invoice']
order = tmp_order['data']
diff --git a/addons/point_of_sale/security/point_of_sale_security.xml b/addons/point_of_sale/security/point_of_sale_security.xml
index 54572ee3eb9..5e98bcba49e 100644
--- a/addons/point_of_sale/security/point_of_sale_security.xml
+++ b/addons/point_of_sale/security/point_of_sale_security.xml
@@ -19,5 +19,11 @@
[('company_id', '=', user.company_id.id)]
+
+ Point Of Sale Config
+
+
+ [('warehouse_id.company_id','child_of',[user.company_id.id])]
+
diff --git a/addons/portal/mail_message.py b/addons/portal/mail_message.py
index 4429df3be8b..36b06484e9e 100644
--- a/addons/portal/mail_message.py
+++ b/addons/portal/mail_message.py
@@ -35,14 +35,14 @@ class mail_message(osv.Model):
"""
if uid == SUPERUSER_ID:
return super(mail_message, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,
- context=context, count=False, access_rights_uid=access_rights_uid)
+ context=context, count=count, access_rights_uid=access_rights_uid)
group_ids = self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id
group_user_id = self.pool.get("ir.model.data").get_object_reference(cr, uid, 'base', 'group_user')[1]
if group_user_id not in [group.id for group in group_ids]:
args = [('subtype_id', '!=', False)] + list(args)
return super(mail_message, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,
- context=context, count=False, access_rights_uid=access_rights_uid)
+ context=context, count=count, access_rights_uid=access_rights_uid)
def check_access_rule(self, cr, uid, ids, operation, context=None):
""" Add Access rules of mail.message for non-employee user:
diff --git a/addons/project/project.py b/addons/project/project.py
index 273fb4fcf3e..d5f4f891c61 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -729,9 +729,10 @@ class task(osv.osv):
context = {}
if default is None:
default = {}
- stage = self._get_default_stage_id(cr, uid, context=context)
- if stage:
- default['stage_id'] = stage
+ if not context.get('copy', False):
+ stage = self._get_default_stage_id(cr, uid, context=context)
+ if stage:
+ default['stage_id'] = stage
return super(task, self).copy(cr, uid, id, default, context)
def _is_template(self, cr, uid, ids, field_name, arg, context=None):
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index f53111bf47a..fa2a415f443 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -634,10 +634,9 @@ class purchase_order(osv.osv):
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.in'),
'origin': order.name + ((order.origin and (':' + order.origin)) or ''),
'date': self.date_to_datetime(cr, uid, order.date_order, context),
- 'partner_id': order.dest_address_id.id or order.partner_id.id,
+ 'partner_id': order.partner_id.id,
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
'type': 'in',
- 'partner_id': order.dest_address_id.id or order.partner_id.id,
'purchase_id': order.id,
'company_id': order.company_id.id,
'move_lines' : [],
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 3f31837e38e..e2caa76f911 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -108,7 +108,7 @@ class purchase_requisition(osv.osv):
seller_delay = product_supplier.delay
seller_qty = product_supplier.qty
supplier_pricelist = supplier.property_product_pricelist_purchase or False
- seller_price = pricelist.price_get(cr, uid, [supplier_pricelist.id], product.id, qty, False, {'uom': default_uom_po_id})[supplier_pricelist.id]
+ seller_price = pricelist.price_get(cr, uid, [supplier_pricelist.id], product.id, qty, supplier.id, {'uom': default_uom_po_id})[supplier_pricelist.id]
if seller_qty:
qty = max(qty,seller_qty)
date_planned = self._planned_date(requisition_line.requisition_id, seller_delay)
diff --git a/addons/report_webkit/default_header.html b/addons/report_webkit/default_header.html
index 0798209a5b7..37fd4135b62 100644
--- a/addons/report_webkit/default_header.html
+++ b/addons/report_webkit/default_header.html
@@ -1,3 +1,4 @@
+
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index 4f56d7efea7..60fb536ca96 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -112,6 +112,7 @@ def webkit_report_extender(report_name):
return fct
return fct1
+
class WebKitParser(report_sxw):
"""Custom class that use webkit to render HTML reports
Code partially taken from report openoffice. Thanks guys :)
@@ -173,7 +174,7 @@ class WebKitParser(report_sxw):
),
'w'
)
- head_file.write(header.encode('utf-8'))
+ head_file.write(self._sanitize_html(header.encode('utf-8')))
head_file.close()
file_to_del.append(head_file.name)
command.extend(['--header-html', head_file.name])
@@ -184,7 +185,7 @@ class WebKitParser(report_sxw):
),
'w'
)
- foot_file.write(footer.encode('utf-8'))
+ foot_file.write(self._sanitize_html(footer.encode('utf-8')))
foot_file.close()
file_to_del.append(foot_file.name)
command.extend(['--footer-html', foot_file.name])
@@ -205,7 +206,7 @@ class WebKitParser(report_sxw):
for html in html_list :
html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w')
count += 1
- html_file.write(html.encode('utf-8'))
+ html_file.write(self._sanitize_html(html.encode('utf-8')))
html_file.close()
file_to_del.append(html_file.name)
command.append(html_file.name)
@@ -366,7 +367,6 @@ class WebKitParser(report_sxw):
pdf = self.generate_pdf(bin, report_xml, head, foot, htmls)
return (pdf, 'pdf')
-
def create(self, cursor, uid, ids, data, context=None):
"""We override the create function in order to handle generator
Code taken from report openoffice. Thanks guys :) """
@@ -387,11 +387,18 @@ class WebKitParser(report_sxw):
report_xml.report_sxw = None
else:
return super(WebKitParser, self).create(cursor, uid, ids, data, context)
- if report_xml.report_type != 'webkit' :
+ if report_xml.report_type != 'webkit':
return super(WebKitParser, self).create(cursor, uid, ids, data, context)
result = self.create_source_pdf(cursor, uid, ids, data, report_xml, context)
if not result:
return (False,False)
return result
+ def _sanitize_html(self, html):
+ """wkhtmltopdf expects the html page to declare a doctype.
+ """
+ if html and html[:9].upper() != "\n" + html
+ return html
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 3512d44f7c7..f1a7c704b02 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -180,8 +180,8 @@ class sale_order(osv.osv):
'date_confirm': fields.date('Confirmation Date', readonly=True, select=True, help="Date on which sales order is confirmed."),
'user_id': fields.many2one('res.users', 'Salesperson', states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True, track_visibility='onchange'),
'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, required=True, change_default=True, select=True, track_visibility='always'),
- 'partner_invoice_id': fields.many2one('res.partner', 'Invoice Address', domain="[('parent_id','=',partner_id)]", readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Invoice address for current sales order."),
- 'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', domain="[('parent_id','=',partner_id)]", readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Delivery address for current sales order."),
+ 'partner_invoice_id': fields.many2one('res.partner', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Invoice address for current sales order."),
+ 'partner_shipping_id': fields.many2one('res.partner', 'Delivery Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Delivery address for current sales order."),
'order_policy': fields.selection([
('manual', 'On Demand'),
], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
@@ -501,7 +501,7 @@ class sale_order(osv.osv):
lines.append(line.id)
created_lines = obj_sale_order_line.invoice_line_create(cr, uid, lines)
if created_lines:
- invoices.setdefault(o.partner_id.id, []).append((o, created_lines))
+ invoices.setdefault(o.partner_invoice_id.id or o.partner_id.id, []).append((o, created_lines))
if not invoices:
for o in self.browse(cr, uid, ids, context=context):
for i in o.invoice_ids:
diff --git a/addons/sale/wizard/sale_make_invoice.py b/addons/sale/wizard/sale_make_invoice.py
index 3712feda20b..170259824f7 100644
--- a/addons/sale/wizard/sale_make_invoice.py
+++ b/addons/sale/wizard/sale_make_invoice.py
@@ -55,11 +55,12 @@ class sale_make_invoice(osv.osv_memory):
raise osv.except_osv(_('Warning!'), _("You shouldn't manually invoice the following sale order %s") % (sale_order.name))
order_obj.action_invoice_create(cr, uid, context.get(('active_ids'), []), data['grouped'], date_invoice=data['invoice_date'])
-
- for o in order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context):
+ orders = order_obj.browse(cr, uid, context.get(('active_ids'), []), context=context)
+ for o in orders:
for i in o.invoice_ids:
newinv.append(i.id)
-
+ # Dummy call to workflow, will not create another invoice but bind the new invoice to the subflow
+ order_obj.signal_manual_invoice(cr, uid, [o.id for o in orders if o.order_policy == 'manual'])
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]
diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py
index f6ee6379ef1..0a21d228ffd 100644
--- a/addons/share/wizard/share_wizard.py
+++ b/addons/share/wizard/share_wizard.py
@@ -925,7 +925,7 @@ class share_result_line(osv.osv_memory):
'login': fields.related('user_id', 'login', string='Login', type='char', size=64, required=True, readonly=True),
'password': fields.char('Password', size=64, readonly=True),
'share_url': fields.function(_share_url, string='Share URL', type='char', size=512),
- 'share_wizard_id': fields.many2one('share.wizard', 'Share Wizard', required=True),
+ 'share_wizard_id': fields.many2one('share.wizard', 'Share Wizard', required=True, ondelete='cascade'),
'newly_created': fields.boolean('Newly created', readonly=True),
}
_defaults = {
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index d48ff80b1c1..7e73d7fcd53 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2232,14 +2232,14 @@ class stock_move(osv.osv):
if move.picking_id:
pickings.add(move.picking_id.id)
if move.move_dest_id and move.move_dest_id.state == 'waiting':
- self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'})
+ self.write(cr, uid, [move.move_dest_id.id], {'state': 'confirmed'}, context=context)
if context.get('call_unlink',False) and move.move_dest_id.picking_id:
workflow.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
- self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False})
+ self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}, context=context)
if not context.get('call_unlink',False):
for pick in self.pool.get('stock.picking').browse(cr, uid, list(pickings), context=context):
if all(move.state == 'cancel' for move in pick.move_lines):
- self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'})
+ self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}, context=context)
for id in ids:
workflow.trg_trigger(uid, 'stock.move', id, cr)
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 0443b888ef7..18eddb7a6aa 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -786,7 +786,7 @@
-
+
@@ -920,7 +920,7 @@
-
+
@@ -1047,7 +1047,7 @@
-
+
diff --git a/addons/stock/wizard/stock_change_product_qty.py b/addons/stock/wizard/stock_change_product_qty.py
index 01ed6f2409a..cf4099ac3ba 100644
--- a/addons/stock/wizard/stock_change_product_qty.py
+++ b/addons/stock/wizard/stock_change_product_qty.py
@@ -33,6 +33,10 @@ class stock_change_product_qty(osv.osv_memory):
'prodlot_id': fields.many2one('stock.production.lot', 'Serial Number', domain="[('product_id','=',product_id)]"),
'location_id': fields.many2one('stock.location', 'Location', required=True, domain="[('usage', '=', 'internal')]"),
}
+ _defaults = {
+ 'new_quantity': 1,
+ 'product_id': lambda self, cr, uid, ctx: ctx and ctx.get('active_id', False) or False
+ }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None: context = {}
@@ -54,20 +58,22 @@ class stock_change_product_qty(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- product_id = context and context.get('active_id', False) or False
+
res = super(stock_change_product_qty, self).default_get(cr, uid, fields, context=context)
- if 'new_quantity' in fields:
- res.update({'new_quantity': 1})
- if 'product_id' in fields:
- res.update({'product_id': product_id})
if 'location_id' in fields:
- try:
- model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
- self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
- except (orm.except_orm, ValueError):
- location_id = False
- res.update({'location_id': location_id})
+ location_id = res.get('location_id', False)
+ if not location_id:
+ try:
+ model, location_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_stock')
+ except (orm.except_orm, ValueError):
+ pass
+ if location_id:
+ try:
+ self.pool.get('stock.location').check_access_rule(cr, uid, [location_id], 'read', context=context)
+ except (orm.except_orm, ValueError):
+ pass
+ res['location_id'] = location_id
return res
def change_product_qty(self, cr, uid, ids, context=None):
diff --git a/addons/stock/wizard/stock_move_view.xml b/addons/stock/wizard/stock_move_view.xml
index 5dc0d0d824c..f2bc40d9a3f 100644
--- a/addons/stock/wizard/stock_move_view.xml
+++ b/addons/stock/wizard/stock_move_view.xml
@@ -67,6 +67,7 @@
form
form
new
+ {'form_view_ref': False}
@@ -124,6 +125,7 @@
form
form
new
+ {'form_view_ref': False}
diff --git a/addons/subscription/__openerp__.py b/addons/subscription/__openerp__.py
index b301525eb42..5f8a1d1338b 100644
--- a/addons/subscription/__openerp__.py
+++ b/addons/subscription/__openerp__.py
@@ -37,7 +37,7 @@ e.g. To have an invoice generated automatically periodically:
above. Specify the interval information and partner to be invoice.
""",
'author': 'OpenERP SA',
- 'depends': [],
+ 'depends': ['base'],
'data': ['security/subcription_security.xml', 'security/ir.model.access.csv', 'subscription_view.xml'],
'demo': ['subscription_demo.xml',],
'installable': True,
diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py
index 44d3bec7f6e..e16d0d6ce77 100644
--- a/addons/survey/wizard/survey_send_invitation.py
+++ b/addons/survey/wizard/survey_send_invitation.py
@@ -128,23 +128,14 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
for use in exist_user:
new_user.append(use.id)
for id in survey_ref.browse(cr, uid, survey_ids):
- report = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title)
- file = open(get_module_resource('survey', 'report') + id.title +".pdf")
- file_data = ""
- while 1:
- line = file.readline()
- file_data += line
- if not line:
- break
- file.close()
- attachments[id.title +".pdf"] = file_data
- os.remove(get_module_resource('survey', 'report') + id.title +".pdf")
+ result, format = openerp.report.render_report(cr, uid, [id.id], 'survey.form', {}, {})
+ attachments[id.title +".pdf"] = result
for partner in self.pool.get('res.partner').browse(cr, uid, partner_ids):
if not partner.email:
skipped+= 1
continue
- user = user_ref.search(cr, uid, [('login', "=", partner.email)])
+ user = user_ref.search(cr, uid, [('partner_id', "=", partner.id)])
if user:
if user[0] not in new_user:
new_user.append(user[0])
@@ -185,6 +176,8 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
if ans:
res_data = {'name': partner.name or _('Unknown'),
'login': partner.email,
+ 'email': partner.email,
+ 'partner_id': partner.id,
'password': passwd,
'address_id': partner.id,
'groups_id': [[6, 0, [group_id]]],