diff --git a/ext/custom-addons/dp_custom/models/stock.py b/ext/custom-addons/dp_custom/models/stock.py
index 3ca1c36e..a34b0a19 100644
--- a/ext/custom-addons/dp_custom/models/stock.py
+++ b/ext/custom-addons/dp_custom/models/stock.py
@@ -60,3 +60,42 @@ class StockPicking(models.Model):
res = lang_obj.format('%.' + str(2) + 'f', value, grouping=True, monetary=True)
return res
+
+class StockMove(models.Model):
+ _inherit = "stock.move"
+
+ manu_lots_visible = fields.Boolean(compute='_compute_manu_lots_visible')
+
+ @api.multi
+ def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
+ self.ensure_one()
+ vals = super(StockMove, self)._prepare_move_line_vals(quantity=quantity, reserved_quant=reserved_quant)
+ if self.sale_line_id.lot_id and not self.sale_line_id.product_id.can_be_sold_unconfigured:
+ move_lot = self.sale_line_id.lot_id.id
+ vals.update({'lot_id': move_lot, })
+ return vals
+
+ def _compute_manu_lots_visible(self):
+ for move_line in self:
+ if not move_line.product_id.can_be_sold_unconfigured:
+ move_line.manu_lots_visible = True
+
+ @api.multi
+ def action_show_lot(self):
+ self.ensure_one()
+ action = self.env.ref('stock.action_production_lot_form').read()[0]
+ action['res_id'] = self.move_line_ids.lot_id.id
+ action['view_mode'] = 'form'
+ action['views'] = [(False, 'form')]
+
+ return action
+
+ @api.depends('product_id', 'product_uom_qty', 'product_uom')
+ def _cal_move_weight(self):
+ for move in self:
+ if move.sale_line_id.lot_id and not move.product_id.can_be_sold_unconfigured:
+ move.weight += (move.product_qty * move.sale_line_id.lot_id.weight)
+ else:
+ move.weight += (move.product_qty * move.product_id.weight)
+
+# print(move.weight)
\ No newline at end of file
diff --git a/ext/custom-addons/dp_custom/views/stock_views.xml b/ext/custom-addons/dp_custom/views/stock_views.xml
index 4c012e2a..e974a8a8 100644
--- a/ext/custom-addons/dp_custom/views/stock_views.xml
+++ b/ext/custom-addons/dp_custom/views/stock_views.xml
@@ -22,4 +22,17 @@
|
-
- |
|
+ |
+ : |