Skip to content

Commit 65f68c1

Browse files
committed
[MERGE] forward port of branch saas-3 up to 7dd6954
2 parents eafa5ff + 7dd6954 commit 65f68c1

File tree

7 files changed

+28
-8
lines changed

7 files changed

+28
-8
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ _build/
33

44
# dotfiles
55
.*
6+
!.gitignore
67
# compiled python files
78
*.py[co]
89
# setup.py egg_info
@@ -12,7 +13,8 @@ _build/
1213
# hg stuff
1314
*.orig
1415
status
15-
16+
# odoo filestore
17+
openerp/filestore
1618
# generated for windows installer?
1719
install/win32/*.bat
1820
install/win32/meta.py

addons/delivery/sale.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def delivery_set(self, cr, uid, ids, context=None):
7474
if not grid_id:
7575
raise osv.except_osv(_('No Grid Available!'), _('No grid matching for this carrier!'))
7676

77-
if order.state != 'draft':
77+
if order.state not in ('draft', 'sent'):
7878
raise osv.except_osv(_('Order not in Draft State!'), _('The order state have to be draft to add delivery lines.'))
7979

8080
grid = grid_obj.browse(cr, uid, grid_id, context=context)

addons/mail/mail_thread.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,14 @@ def _message_extract_payload(self, message, save_original=False):
11641164
body = u''
11651165
if save_original:
11661166
attachments.append(('original_email.eml', message.as_string()))
1167-
if not message.is_multipart() or 'text/' in message.get('content-type', ''):
1167+
1168+
# Be careful, content-type may contain tricky content like in the
1169+
# following example so test the MIME type with startswith()
1170+
#
1171+
# Content-Type: multipart/related;
1172+
# boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_";
1173+
# type="text/html"
1174+
if not message.is_multipart() or message.get('content-type', '').startswith("text/"):
11681175
encoding = message.get_content_charset()
11691176
body = message.get_payload(decode=True)
11701177
body = tools.ustr(body, encoding, errors='replace')
@@ -1893,4 +1900,4 @@ def message_change_thread(self, cr, uid, id, new_res_id, new_model, context=None
18931900
message_obj.write(cr, uid, msg_ids_comment, {"res_id" : new_res_id, "model" : new_model}, context=context)
18941901
message_obj.write(cr, uid, msg_ids_not_comment, {"res_id" : new_res_id, "model" : new_model, "subtype_id" : None}, context=context)
18951902

1896-
return True
1903+
return True

addons/purchase/purchase.py

+6
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ def action_cancel_draft(self, cr, uid, ids, context=None):
498498
if not len(ids):
499499
return False
500500
self.write(cr, uid, ids, {'state':'draft','shipped':0})
501+
for purchase in self.browse(cr, uid, ids, context=context):
502+
self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line], {'state': 'draft'})
501503
for p_id in ids:
502504
# Deleting the existing instance of workflow for PO
503505
self.delete_workflow(cr, uid, [p_id]) # TODO is it necessary to interleave the calls?
@@ -593,6 +595,8 @@ def action_cancel(self, cr, uid, ids, context=None):
593595
_('You must first cancel all receptions related to this purchase order.'))
594596
self.pool.get('account.invoice') \
595597
.signal_invoice_cancel(cr, uid, map(attrgetter('id'), purchase.invoice_ids))
598+
self.pool['purchase.order.line'].write(cr, uid, [l.id for l in purchase.order_line],
599+
{'state': 'cancel'})
596600
self.write(cr,uid,ids,{'state':'cancel'})
597601

598602
self.signal_purchase_cancel(cr, uid, ids)
@@ -903,6 +907,8 @@ def copy_data(self, cr, uid, id, default=None, context=None):
903907
def unlink(self, cr, uid, ids, context=None):
904908
procurement_ids_to_cancel = []
905909
for line in self.browse(cr, uid, ids, context=context):
910+
if line.state not in ['draft', 'cancel']:
911+
raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a purchase order line which is in state \'%s\'.') %(line.state,))
906912
if line.move_dest_id:
907913
procurement_ids_to_cancel.extend(procurement.id for procurement in line.move_dest_id.procurements)
908914
if procurement_ids_to_cancel:

addons/sale/sale.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,18 @@ def action_invoice_create(self, cr, uid, ids, grouped=False, states=None, date_i
510510
if grouped:
511511
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
512512
invoice_ref = ''
513+
origin_ref = ''
513514
for o, l in val:
514-
invoice_ref += o.name + '|'
515+
invoice_ref += (o.client_order_ref or o.name) + '|'
516+
origin_ref += (o.origin or o.name) + '|'
515517
self.write(cr, uid, [o.id], {'state': 'progress'})
516518
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
517519
#remove last '|' in invoice_ref
518-
if len(invoice_ref) >= 1:
520+
if len(invoice_ref) >= 1:
519521
invoice_ref = invoice_ref[:-1]
520-
invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
522+
if len(origin_ref) >= 1:
523+
origin_ref = origin_ref[:-1]
524+
invoice.write(cr, uid, [res], {'origin': origin_ref, 'name': invoice_ref})
521525
else:
522526
for order, il in val:
523527
res = self._make_invoice(cr, uid, order, il, context=context)

addons/stock/stock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,7 @@ def action_done(self, cr, uid, ids, context=None):
23952395
picking_ids.append(move.picking_id.id)
23962396
if move.move_dest_id.id and (move.state != 'done'):
23972397
# Downstream move should only be triggered if this move is the last pending upstream move
2398-
other_upstream_move_ids = self.search(cr, uid, [('id','!=',move.id),('state','not in',['done','cancel']),
2398+
other_upstream_move_ids = self.search(cr, uid, [('id','not in',move_ids),('state','not in',['done','cancel']),
23992399
('move_dest_id','=',move.move_dest_id.id)], context=context)
24002400
if not other_upstream_move_ids:
24012401
self.write(cr, uid, [move.id], {'move_history_ids': [(4, move.move_dest_id.id)]})

openerp/addons/base/security/ir.model.access.csv

+1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"access_multi_company_default manager","multi_company_default Manager","model_multi_company_default","group_erp_manager",1,1,1,1
109109
"access_ir_filter all","ir_filters all","model_ir_filters",,1,1,1,1
110110
"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
111112
"access_ir_mail_server","ir_mail_server","model_ir_mail_server","group_system",1,1,1,1
112113
"access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0
113114
"access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1

0 commit comments

Comments
 (0)