Skip to content

Commit

Permalink
Merge PR #1284 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 11, 2023
2 parents bccdefa + 07e4c27 commit 5f55f9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stock_no_negative/models/stock_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class StockQuant(models.Model):

@api.constrains("product_id", "quantity")
def check_negative_qty(self):
# To provide an option to skip the check when necessary.
# e.g. mrp_subcontracting_skip_no_negative - passes the context
# for subcontracting receipts.
if self.env.context.get("skip_negative_qty_check"):
return
p = self.env["decimal.precision"].precision_get("Product Unit of Measure")
check_negative_qty = (
config["test_enable"] and self.env.context.get("test_stock_no_negative")
Expand Down

0 comments on commit 5f55f9f

Please sign in to comment.