mirror of
https://github.com/bringout/oca-ocb-pos.git
synced 2026-04-24 08:42:08 +02:00
19.0 vanilla
This commit is contained in:
parent
6e54c1af6c
commit
3ca647e428
1087 changed files with 132065 additions and 108499 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class PosOrderLine(models.Model):
|
||||
_inherit = "pos.order.line"
|
||||
|
||||
|
|
@ -12,10 +13,11 @@ class PosOrderLine(models.Model):
|
|||
if not bom:
|
||||
return super()._get_stock_moves_to_consider(stock_moves, product)
|
||||
boms, components = bom.explode(product, self.qty)
|
||||
#Get a flat list of all bom_line_ids
|
||||
bom_line_ids = [item.id for x in boms for item in x[0].bom_line_ids if set(item.bom_product_template_attribute_value_ids.ids).issubset(product.product_template_variant_value_ids.ids)]
|
||||
ml_product_to_consider = (product.bom_ids and [comp[0].product_id.id for comp in components]) or [product.id]
|
||||
if len(boms) > 1:
|
||||
return stock_moves.filtered(lambda ml: ml.product_id.id in ml_product_to_consider and ml.bom_line_id)
|
||||
return stock_moves.filtered(lambda ml: ml.product_id.id in ml_product_to_consider and (ml.bom_line_id in bom.bom_line_ids))
|
||||
return stock_moves.filtered(lambda ml: ml.product_id.id in ml_product_to_consider and (ml.bom_line_id.id in bom_line_ids)).with_context(pos_order_line_id=self.id, bom_id=bom.id)
|
||||
|
||||
|
||||
class PosOrder(models.Model):
|
||||
_inherit = "pos.order"
|
||||
|
|
@ -29,6 +31,6 @@ class PosOrder(models.Model):
|
|||
for comp in components:
|
||||
price_unit = super()._get_pos_anglo_saxon_price_unit(comp[0].product_id, partner_id, comp[1]['qty'])
|
||||
price_unit = comp[0].product_id.uom_id._compute_price(price_unit, comp[0].product_uom_id)
|
||||
qty_per_kit = comp[1]['qty'] / bom.product_qty / quantity
|
||||
qty_per_kit = comp[1]['qty'] / bom.product_qty / (quantity or 1)
|
||||
total_price_unit += price_unit * qty_per_kit
|
||||
return total_price_unit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue