[MERGE] forward port of branch saas-3 up to 7dd6954
This commit is contained in:
commit
65f68c1f65
|
@ -3,6 +3,7 @@ _build/
|
|||
|
||||
# dotfiles
|
||||
.*
|
||||
!.gitignore
|
||||
# compiled python files
|
||||
*.py[co]
|
||||
# setup.py egg_info
|
||||
|
@ -12,7 +13,8 @@ _build/
|
|||
# hg stuff
|
||||
*.orig
|
||||
status
|
||||
|
||||
# odoo filestore
|
||||
openerp/filestore
|
||||
# generated for windows installer?
|
||||
install/win32/*.bat
|
||||
install/win32/meta.py
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1164,7 +1164,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')
|
||||
|
|
|
@ -498,6 +498,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?
|
||||
|
@ -593,6 +595,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)
|
||||
|
@ -903,6 +907,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:
|
||||
|
|
|
@ -510,14 +510,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:
|
||||
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)
|
||||
|
|
|
@ -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)]})
|
||||
|
|
|
@ -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
|
||||
|
|
|
Loading…
Reference in New Issue