7 changed files with 57 additions and 4 deletions
@ -0,0 +1,18 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
|
||||
|
import Registries from 'point_of_sale.Registries'; |
||||
|
import { Product } from 'point_of_sale.models'; |
||||
|
|
||||
|
const RestrictProduct = (Product) => class RestrictProduct extends Product { |
||||
|
setQty(qty) { |
||||
|
if (this.detailed_type !== 'service' && |
||||
|
this.pos.config.is_display_stock && |
||||
|
this.pos.company.point_of_sale_update_stock_quantities == 'real') { |
||||
|
this.qty_available -= qty; |
||||
|
this.virtual_available -= qty; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
Registries.Model.extend(Product, RestrictProduct); |
||||
|
|
@ -0,0 +1,18 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
|
||||
|
import Registries from 'point_of_sale.Registries'; |
||||
|
import ReceiptScreen from 'point_of_sale.ReceiptScreen'; |
||||
|
|
||||
|
const RestrictReceiptScreen = (ReceiptScreen) => { |
||||
|
class RestrictReceiptScreen extends ReceiptScreen { |
||||
|
async orderDone() { |
||||
|
this.env.pos.get_order().orderlines.forEach(element => { |
||||
|
element.product.setQty(element.quantity); |
||||
|
}); |
||||
|
await super.orderDone(); |
||||
|
} |
||||
|
} |
||||
|
return RestrictReceiptScreen; |
||||
|
}; |
||||
|
Registries.Component.extend(ReceiptScreen, RestrictReceiptScreen); |
||||
|
|
Loading…
Reference in new issue