Cron Export Stock Kit

This commit is contained in:
resteve 2015-05-25 16:47:30 +02:00
parent b06b0d8ba4
commit 9092743046
3 changed files with 34 additions and 0 deletions

20
esale.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!-- This file is part esale_stock module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<!-- esale.cron -->
<record model="ir.cron" id="cron_esale_export_stock_kit">
<field name="name">eSale - Export Stock Kit</field>
<field name="request_user" ref="res.user_admin"/>
<field name="user" ref="esale.user_esale"/>
<field name="active" eval="True"/>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="number_calls">-1</field>
<field name="repeat_missed" eval="False"/>
<field name="model">sale.shop</field>
<field name="function">export_cron_stock_kit</field>
</record>
</data>
</tryton>

13
shop.py
View File

@ -28,3 +28,16 @@ class SaleShop:
export_products = getattr(shop,
'export_stocks_kit_%s' % shop.esale_shop_app)
export_products()
@classmethod
def export_cron_stock_kit(cls):
"""
Cron export stock kit
"""
print "dins cron"
shops = cls.search([
('esale_available', '=', True),
('esale_scheduler', '=', True),
])
cls.export_stocks_kit(shops)
return True

View File

@ -5,4 +5,5 @@ depends:
esale_stock
product_kit
xml:
esale.xml
shop.xml