diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-07-24 08:55:26 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-07-24 08:55:26 +0700 |
| commit | 968f63a411f8cc9e190a261123e47604ce54c2b2 (patch) | |
| tree | 60ad4bb324ccc67ab2e9045def163a413675e968 /indoteknik_custom/models | |
| parent | 2a1179b22cd1b8ee9e3e31c157821dbbeb66195f (diff) | |
fix bug and refactor api product sla
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/models/stock_vendor.py | 9 |
2 files changed, 1 insertions, 10 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 1a83b702..7abdf1c1 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -221,7 +221,7 @@ class ProductTemplate(models.Model): datas = json.loads(response.text)['data'] qty = 0 for data in datas: - availability = int(data['availability']) # Mengonversi ke tipe data int + availability = float(data['availability']) # Mengonversi ke tipe data int qty += availability # Mengakumulasi qty dari setiap data return qty diff --git a/indoteknik_custom/models/stock_vendor.py b/indoteknik_custom/models/stock_vendor.py index dcbeb399..f214a5e1 100755 --- a/indoteknik_custom/models/stock_vendor.py +++ b/indoteknik_custom/models/stock_vendor.py @@ -17,15 +17,6 @@ class StockVendor(models.Model): ('done', 'Done') ], string="Cache Reset") - def get_stock_updated_last_7_days(self): - date_7_days_ago = datetime.now() - timedelta(days=7) - - stocks = self.search([ - ('write_date', '>=', date_7_days_ago.strftime("%Y-%m-%d %H:%M:%S")) - ], limit=1) - - return stocks - def cache_reset(self): stocks = self.env['stock.vendor'].search([ ('cache_reset_status', '=', 'reset'), |
