diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-03-29 10:47:03 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-03-29 10:47:03 +0700 |
| commit | 8b93bf1b46259076987c8442986c5b73ac5a2f00 (patch) | |
| tree | 98e311e5bada94c9121905db777747b1dd84686d | |
| parent | 2e45cefae9b6f757fd29fb304d6935c1826f2c5b (diff) | |
only qty purchase greater than zero will be convert to po
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index d34a7aa1..97f77070 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -35,7 +35,11 @@ class AutomaticPurchase(models.Model): 'date_order': current_time } new_po = self.env['purchase.order'].create([param_header]) - products_vendors = self.env['automatic.purchase.line'].search([('automatic_purchase_id', '=', self.id), ('partner_id', '=', vendor['partner_id'][0])]) + products_vendors = self.env['automatic.purchase.line'].search([ + ('automatic_purchase_id', '=', self.id), + ('partner_id', '=', vendor['partner_id'][0]), + ('qty_purchase', '>', 0) + ]) count=0 for product in products_vendors: count += 10 |
