[MERGE] forward port of branch 7.0 up to 0c4bc1c

This commit is contained in:
Christophe Simonis 2014-06-03 19:11:44 +02:00
commit 7dd69540e8
8 changed files with 54 additions and 21 deletions

View File

@ -1,15 +0,0 @@
.*
*.egg-info
*.orig
*.vim
build/
RE:^bin/
RE:^dist/
RE:^include/
RE:^share/
RE:^man/
RE:^lib/
RE:^addons/\w+/doc/_build/
RE:^.*?/node_modules

30
.gitignore vendored Normal file
View File

@ -0,0 +1,30 @@
# sphinx build directories
_build/
# dotfiles
.*
!.gitignore
# compiled python files
*.py[co]
# setup.py egg_info
*.egg-info
# emacs backup files
*~
# hg stuff
*.orig
status
# odoo filestore
openerp/filestore
# generated for windows installer?
install/win32/*.bat
install/win32/meta.py
# various virtualenv
/bin/
/build/
/dist/
/include/
/lib/
/man/
/share/
/src/

View File

@ -74,7 +74,7 @@ class sale_order(osv.Model):
if not grid_id:
raise osv.except_osv(_('No Grid Available!'), _('No grid matching for this carrier!'))
if order.state != 'draft':
if order.state not in ('draft', 'sent'):
raise osv.except_osv(_('Order not in Draft State!'), _('The order state have to be draft to add delivery lines.'))
grid = grid_obj.browse(cr, uid, grid_id, context=context)

View File

@ -1132,7 +1132,14 @@ class mail_thread(osv.AbstractModel):
body = u''
if save_original:
attachments.append(('original_email.eml', message.as_string()))
if not message.is_multipart() or 'text/' in message.get('content-type', ''):
# Be careful, content-type may contain tricky content like in the
# following example so test the MIME type with startswith()
#
# Content-Type: multipart/related;
# boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_";
# type="text/html"
if not message.is_multipart() or message.get('content-type', '').startswith("text/"):
encoding = message.get_content_charset()
body = message.get_payload(decode=True)
body = tools.ustr(body, encoding, errors='replace')

View File

@ -503,6 +503,8 @@ class purchase_order(osv.osv):
if not len(ids):
return False
self.write(cr, uid, ids, {'state':'draft','shipped':0})
for purchase in self.browse(cr, uid, ids, context=context):
self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line], {'state': 'draft'})
for p_id in ids:
# Deleting the existing instance of workflow for PO
self.delete_workflow(cr, uid, [p_id]) # TODO is it necessary to interleave the calls?
@ -598,6 +600,8 @@ class purchase_order(osv.osv):
_('You must first cancel all receptions related to this purchase order.'))
self.pool.get('account.invoice') \
.signal_invoice_cancel(cr, uid, map(attrgetter('id'), purchase.invoice_ids))
self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line],
{'state': 'cancel'})
self.write(cr,uid,ids,{'state':'cancel'})
self.signal_purchase_cancel(cr, uid, ids)
@ -908,6 +912,8 @@ class purchase_order_line(osv.osv):
def unlink(self, cr, uid, ids, context=None):
procurement_ids_to_cancel = []
for line in self.browse(cr, uid, ids, context=context):
if line.state not in ['draft', 'cancel']:
raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a purchase order line which is in state \'%s\'.') %(line.state,))
if line.move_dest_id:
procurement_ids_to_cancel.extend(procurement.id for procurement in line.move_dest_id.procurements)
if procurement_ids_to_cancel:

View File

@ -515,14 +515,18 @@ class sale_order(osv.osv):
if grouped:
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
invoice_ref = ''
origin_ref = ''
for o, l in val:
invoice_ref += o.name + '|'
invoice_ref += (o.client_order_ref or o.name) + '|'
origin_ref += (o.origin or o.name) + '|'
self.write(cr, uid, [o.id], {'state': 'progress'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
#remove last '|' in invoice_ref
if len(invoice_ref) >= 1:
if len(invoice_ref) >= 1:
invoice_ref = invoice_ref[:-1]
invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
if len(origin_ref) >= 1:
origin_ref = origin_ref[:-1]
invoice.write(cr, uid, [res], {'origin': origin_ref, 'name': invoice_ref})
else:
for order, il in val:
res = self._make_invoice(cr, uid, order, il, context=context)

View File

@ -2395,7 +2395,7 @@ class stock_move(osv.osv):
picking_ids.append(move.picking_id.id)
if move.move_dest_id.id and (move.state != 'done'):
# Downstream move should only be triggered if this move is the last pending upstream move
other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
other_upstream_move_ids = self.search(cr, uid, [('id','not in',move_ids),('state','not in',['done','cancel']),
('move_dest_id','=',move.move_dest_id.id)], context=context)
if not other_upstream_move_ids:
self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})

View File

@ -108,6 +108,7 @@
"access_multi_company_default manager","multi_company_default Manager","model_multi_company_default","group_erp_manager",1,1,1,1
"access_ir_filter all","ir_filters all","model_ir_filters",,1,1,1,1
"access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0
"access_ir_config_parameter_system","ir_config_parameter_system","model_ir_config_parameter","group_system",1,1,1,1
"access_ir_mail_server","ir_mail_server","model_ir_mail_server","group_system",1,1,1,1
"access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0
"access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
108 access_multi_company_default manager multi_company_default Manager model_multi_company_default group_erp_manager 1 1 1 1
109 access_ir_filter all ir_filters all model_ir_filters 1 1 1 1
110 access_ir_config_parameter ir_config_parameter model_ir_config_parameter 1 0 0 0
111 access_ir_config_parameter_system ir_config_parameter_system model_ir_config_parameter group_system 1 1 1 1
112 access_ir_mail_server ir_mail_server model_ir_mail_server group_system 1 1 1 1
113 access_ir_actions_client ir_actions_client all model_ir_actions_client 1 0 0 0
114 access_ir_needaction_mixin ir_needaction_mixin model_ir_needaction_mixin 1 1 1 1