Merge branch 'master-haresh-19072018' into 'master-patch-july-2018'
[IMP] Added Upstream Patch for [Purchase] See merge request flectra-hq/flectra!107
This commit is contained in:
commit
41baf6a0da
@ -508,7 +508,7 @@ class PurchaseOrder(models.Model):
|
|||||||
result['context'] = {}
|
result['context'] = {}
|
||||||
pick_ids = self.mapped('picking_ids')
|
pick_ids = self.mapped('picking_ids')
|
||||||
#choose the view_mode accordingly
|
#choose the view_mode accordingly
|
||||||
if len(pick_ids) > 1:
|
if not pick_ids or len(pick_ids) > 1:
|
||||||
result['domain'] = "[('id','in',%s)]" % (pick_ids.ids)
|
result['domain'] = "[('id','in',%s)]" % (pick_ids.ids)
|
||||||
elif len(pick_ids) == 1:
|
elif len(pick_ids) == 1:
|
||||||
res = self.env.ref('stock.view_picking_form', False)
|
res = self.env.ref('stock.view_picking_form', False)
|
||||||
|
@ -11,17 +11,6 @@ class StockPicking(models.Model):
|
|||||||
purchase_id = fields.Many2one('purchase.order', related='move_lines.purchase_line_id.order_id',
|
purchase_id = fields.Many2one('purchase.order', related='move_lines.purchase_line_id.order_id',
|
||||||
string="Purchase Orders", readonly=True)
|
string="Purchase Orders", readonly=True)
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _create_backorder(self, backorder_moves=[]):
|
|
||||||
res = super(StockPicking, self)._create_backorder(backorder_moves)
|
|
||||||
for picking in self:
|
|
||||||
if picking.picking_type_id.code == 'incoming':
|
|
||||||
for backorder in self.search([('backorder_id', '=', picking.id)]):
|
|
||||||
backorder.message_post_with_view('mail.message_origin_link',
|
|
||||||
values={'self': backorder, 'origin': backorder.purchase_id},
|
|
||||||
subtype_id=self.env.ref('mail.mt_note').id)
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class StockMove(models.Model):
|
class StockMove(models.Model):
|
||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
Loading…
Reference in New Issue
Block a user