[FIX] sale, purchase: do not merge sale order and purchase order lines
This commit is contained in:
committed by
Simon Lejeune
parent
ef592ffa3d
commit
faff276e92
@@ -31,6 +31,19 @@ class StockMove(models.Model):
|
||||
created_purchase_line_id = fields.Many2one('purchase.order.line',
|
||||
'Created Purchase Order Line', ondelete='set null', readonly=True, copy=False)
|
||||
|
||||
@api.model
|
||||
def _prepare_merge_moves_distinct_fields(self):
|
||||
distinct_fields = super(StockMove, self)._prepare_merge_moves_distinct_fields()
|
||||
distinct_fields.append('purchase_line_id')
|
||||
return distinct_fields
|
||||
|
||||
@api.model
|
||||
def _prepare_merge_move_sort_method(self, move):
|
||||
move.ensure_one()
|
||||
keys_sorted = super(StockMove, self)._prepare_merge_move_sort_method(move)
|
||||
keys_sorted.append(move.purchase_line_id.id)
|
||||
return keys_sorted
|
||||
|
||||
@api.multi
|
||||
def _get_price_unit(self):
|
||||
""" Returns the unit price for the move"""
|
||||
@@ -148,4 +161,4 @@ class Orderpoint(models.Model):
|
||||
res = super(Orderpoint, self)._quantity_in_progress()
|
||||
for poline in self.env['purchase.order.line'].search([('state','in',('draft','sent','to approve')),('orderpoint_id','in',self.ids)]):
|
||||
res[poline.orderpoint_id.id] += poline.product_uom._compute_quantity(poline.product_qty, poline.orderpoint_id.product_uom, round=False)
|
||||
return res
|
||||
return res
|
||||
|
||||
@@ -13,6 +13,19 @@ class StockMove(models.Model):
|
||||
_inherit = "stock.move"
|
||||
sale_line_id = fields.Many2one('sale.order.line', 'Sale Line')
|
||||
|
||||
@api.model
|
||||
def _prepare_merge_moves_distinct_fields(self):
|
||||
distinct_fields = super(StockMove, self)._prepare_merge_moves_distinct_fields()
|
||||
distinct_fields.append('sale_line_id')
|
||||
return distinct_fields
|
||||
|
||||
@api.model
|
||||
def _prepare_merge_move_sort_method(self, move):
|
||||
move.ensure_one()
|
||||
keys_sorted = super(StockMove, self)._prepare_merge_move_sort_method(move)
|
||||
keys_sorted.append(move.sale_line_id.id)
|
||||
return keys_sorted
|
||||
|
||||
def _action_done(self):
|
||||
result = super(StockMove, self)._action_done()
|
||||
for line in self.mapped('sale_line_id'):
|
||||
|
||||
Reference in New Issue
Block a user