Skip to content

Commit

Permalink
Cron to update catalog #3469
Browse files Browse the repository at this point in the history
Review ID: 1623003
  • Loading branch information
priyankarani committed Dec 24, 2013
1 parent b94ee01 commit 047df24
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions magento.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,5 +505,17 @@
<field name="args" eval="'()'"/>
</record>

<record model="ir.cron" id="ir_cron_update_catalog">
<field name="name">Update Catalog</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="True"/>
<field name="active" eval="False"/>
<field name="model" eval="'product.product'"/>
<field name="function" eval="'update_catalog'"/>
<field name="args" eval="'()'"/>
</record>

</data>
</openerp>
17 changes: 17 additions & 0 deletions product.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,23 @@ def find_using_magento_data(
cursor, user, record_ids[0], context=context
).product or None

def update_catalog(self, cursor, user, ids=None, context=None):
"""
Updates catalog from magento to openerp
:param cursor: Database cursor
:param user: ID of current user
:param ids: List of ids of website
:param context: Application context
"""
if not ids:
ids = self.search(cursor, user, [], context)

for product in self.browse(cursor, user, ids, context):
self.update_from_magento(
cursor, user, product, context
)

def update_from_magento(
self, cursor, user, product, context=None
):
Expand Down

0 comments on commit 047df24

Please sign in to comment.