[IMP] Added Upstream Patch for [Purchase]

This commit is contained in:
Haresh Chavda 2018-07-19 17:34:06 +05:30
parent 750aef6e5f
commit 3c8a45bc03
2 changed files with 1 additions and 12 deletions

View File

@ -508,7 +508,7 @@ class PurchaseOrder(models.Model):
result['context'] = {}
pick_ids = self.mapped('picking_ids')
#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)
elif len(pick_ids) == 1:
res = self.env.ref('stock.view_picking_form', False)

View File

@ -11,17 +11,6 @@ class StockPicking(models.Model):
purchase_id = fields.Many2one('purchase.order', related='move_lines.purchase_line_id.order_id',
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):
_inherit = 'stock.move'