File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ class PurchaseOrder(models.Model):
35
35
def _compute_fop_shipping_reached (self ):
36
36
digit_precision = self .env ["decimal.precision" ].precision_get ("Account" )
37
37
for record in self :
38
+ if (
39
+ float_compare (record .amount_total , 0 , precision_digits = digit_precision )
40
+ < 0
41
+ ):
42
+ record .fop_reached = True
43
+ continue
38
44
record .fop_reached = (
39
45
float_compare (
40
46
record .amount_total ,
Original file line number Diff line number Diff line change @@ -64,3 +64,22 @@ def test_fop_shipping_reached2(self):
64
64
self .assertTrue (po .fop_reached )
65
65
po .button_approve ()
66
66
self .assertEqual (po .state , "purchase" )
67
+
68
+ def test_fop_shipping_negative (self ):
69
+ po = self .Purchase .create ({"partner_id" : self .partner_3 .id })
70
+ self .PurchaseLine .create (
71
+ {
72
+ "order_id" : po .id ,
73
+ "product_id" : self .product_1 .id ,
74
+ "date_planned" : fields .Datetime .now (),
75
+ "name" : "Test" ,
76
+ "product_qty" : 1.0 ,
77
+ "product_uom" : self .product_1 .uom_id .id ,
78
+ "price_unit" : - 100.0 ,
79
+ }
80
+ )
81
+
82
+ self .assertTrue (po .fop_reached )
83
+
84
+ po .button_approve ()
85
+ self .assertEqual (po .state , "purchase" )
You can’t perform that action at this time.
0 commit comments