diff options
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 13 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 13 |
2 files changed, 20 insertions, 6 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 2450abd4..049bee2d 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -41,6 +41,19 @@ class SaleOrderLine(models.Model): qty_free_bu = fields.Float(string='Free BU', compute='_get_qty_free_bandengan') desc_updatable = fields.Boolean(string='desc boolean', default=True, compute='_get_desc_updatable') + def _get_outgoing_incoming_moves(self): + outgoing_moves = self.env['stock.move'] + incoming_moves = self.env['stock.move'] + + for move in self.move_ids.filtered(lambda r: r.state != 'cancel' and not r.scrapped and self.product_id == r.product_id): + if move.location_dest_id.usage == "customer": + if not move.origin_returned_move_id or (move.origin_returned_move_id and move.to_refund): + outgoing_moves |= move + elif move.location_id.usage == "customer" and move.to_refund: + incoming_moves |= move + + return outgoing_moves, incoming_moves + def _get_desc_updatable(self): for line in self: if line.product_id.id != 417724 and line.product_id.id: diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 128efee6..0071bb1a 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1013,13 +1013,14 @@ class StockPicking(models.Model): def action_assign(self): if self.sale_id.hold_outgoing and self.location_id.id == 57 and self.location_dest_id.id == 60: - raise UserError("SO on hold") - res = super(StockPicking, self).action_assign() - # current_time = datetime.datetime.utcnow() - # self.real_shipping_id = self.sale_id.real_shipping_id - # self.date_availability = current_time + print(1) + else: + res = super(StockPicking, self).action_assign() + current_time = datetime.datetime.utcnow() + self.real_shipping_id = self.sale_id.real_shipping_id + self.date_availability = current_time # self.check_state_reserve() - return res + return res def ask_approval(self): if self.env.user.is_accounting: |
