Browse Source

Dec 26 [UPDT] Bug Fixed 'pos_bom'

pull/232/head
AjmalCybro 2 years ago
parent
commit
f5134100ab
  1. 2
      pos_bom/__manifest__.py
  2. 16
      pos_bom/models/stock_picking.py

2
pos_bom/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'POS Product Components', 'name': 'POS Product Components',
'version': '15.0.1.0.0', 'version': '15.0.1.0.1',
'summary': """Helps to handle Product Components in POS""", 'summary': """Helps to handle Product Components in POS""",
'description': """Helps us to configure BOM products in point of sale and manage inventory for such products""", 'description': """Helps us to configure BOM products in point of sale and manage inventory for such products""",
'category': 'Point of Sale', 'category': 'Point of Sale',

16
pos_bom/models/stock_picking.py

@ -40,9 +40,14 @@ class StockPicking(models.Model):
for move in confirmed_moves: for move in confirmed_moves:
if order_lines[0].product_id.is_bom: if order_lines[0].product_id.is_bom:
products = self.env['pos.product.bom'].search( products = self.env['pos.product.bom'].search(
[('product_id.id', '=', order_lines[0].product_id.product_tmpl_id.id)]) [('product_id.id', '=',
order_lines[0].product_id.product_tmpl_id.id)])
bom_components = products.bom_line_ids bom_components = products.bom_line_ids
bom_qty = products.quantity
for rec in bom_components: for rec in bom_components:
rec_required_quantity = rec.quantity / bom_qty
bom = rec.product_id.id bom = rec.product_id.id
pos_bom_move = self.env['stock.move'].create( pos_bom_move = self.env['stock.move'].create(
{ {
@ -52,7 +57,9 @@ class StockPicking(models.Model):
'picking_id': self.id, 'picking_id': self.id,
'picking_type_id': self.picking_type_id.id, 'picking_type_id': self.picking_type_id.id,
'product_id': bom, 'product_id': bom,
'product_uom_qty': abs(sum(order_lines.mapped('qty'))) * rec.quantity, # 'product_uom_qty': abs(sum(order_lines.mapped('qty'))) * rec.quantity,
'product_uom_qty': abs(sum(order_lines.mapped(
'qty'))) * rec_required_quantity,
'state': 'done', 'state': 'done',
'warehouse_id': self.location_dest_id.warehouse_id.id, 'warehouse_id': self.location_dest_id.warehouse_id.id,
'location_id': self.location_id.id, 'location_id': self.location_id.id,
@ -60,6 +67,7 @@ class StockPicking(models.Model):
'company_id': self.company_id.id, 'company_id': self.company_id.id,
} }
) )
print('kkkkk',pos_bom_move) print('kkkkk', pos_bom_move)
pos_bom_move.quantity_done = pos_bom_move.product_uom_qty pos_bom_move.quantity_done = pos_bom_move.product_uom_qty
confirmed_moves._add_mls_related_to_order(lines, are_qties_done=True) confirmed_moves._add_mls_related_to_order(lines,
are_qties_done=True)
Loading…
Cancel
Save