Skip to content

Commit

Permalink
[MERGE] forward port of branch saas-3 up to 7dd6954
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Jun 3, 2014
2 parents eafa5ff + 7dd6954 commit 65f68c1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 8 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ _build/

# dotfiles
.*
!.gitignore
# compiled python files
*.py[co]
# setup.py egg_info
Expand All @@ -12,7 +13,8 @@ _build/
# hg stuff
*.orig
status

# odoo filestore
openerp/filestore
# generated for windows installer?
install/win32/*.bat
install/win32/meta.py
Expand Down
2 changes: 1 addition & 1 deletion addons/delivery/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def delivery_set(self, cr, uid, ids, context=None):
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)
Expand Down
11 changes: 9 additions & 2 deletions addons/mail/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,14 @@ def _message_extract_payload(self, message, save_original=False):
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')
Expand Down Expand Up @@ -1893,4 +1900,4 @@ def message_change_thread(self, cr, uid, id, new_res_id, new_model, context=None
message_obj.write(cr, uid, msg_ids_comment, {"res_id" : new_res_id, "model" : new_model}, context=context)
message_obj.write(cr, uid, msg_ids_not_comment, {"res_id" : new_res_id, "model" : new_model, "subtype_id" : None}, context=context)

return True
return True
6 changes: 6 additions & 0 deletions addons/purchase/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ def action_cancel_draft(self, cr, uid, ids, context=None):
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?
Expand Down Expand Up @@ -593,6 +595,8 @@ def action_cancel(self, cr, uid, ids, context=None):
_('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)
Expand Down Expand Up @@ -903,6 +907,8 @@ def copy_data(self, cr, uid, id, default=None, context=None):
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:
Expand Down
10 changes: 7 additions & 3 deletions addons/sale/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,18 @@ def action_invoice_create(self, cr, uid, ids, grouped=False, states=None, date_i
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)
Expand Down
2 changes: 1 addition & 1 deletion addons/stock/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,7 @@ def action_done(self, cr, uid, ids, context=None):
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)]})
Expand Down
1 change: 1 addition & 0 deletions openerp/addons/base/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 65f68c1

Please sign in to comment.