<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data noupdate="1">

        <record model="ir.cron" id="ir_cron_import_sale_orders" forcecreate="True">
            <field name="name">Walmart - Import Sales Orders</field>
            <field eval="False" name="active"/>
            <field name="state">code</field>
            <field name="user_id" ref="base.user_root"/>
            <field name="interval_number">1</field>
            <field name="interval_type">days</field>
            <field name="numbercall">-1</field>
            <field eval="False" name="doall"/>
            <field ref="connector_walmart.model_walmart_backend" name="model_id"/>
            <field name="code">model._scheduler_import_sale_orders()</field>
        </record>

        <record id="excep_wrong_total_amount" model="exception.rule">
            <field name="name">Total Amount differs from Walmart</field>
            <field name="description">The amount computed in Odoo doesn't match with the amount in Walmart.

Cause:
The taxes are probably different between Odoo and Walmart. A fiscal position could have changed the final price.

Resolution:
Check your taxes and fiscal positions configuration and correct them if necessary.</field>
            <field name="sequence">30</field>
            <field name="model">sale.order</field>
            <field name="rule_group">sale</field>
            <field name="code">if sale.walmart_bind_ids and abs(sale.amount_total - sale.walmart_bind_ids[0].total_amount) >= 0.01:
    failed = True</field>
            <field name="active" eval="True"/>
        </record>

        <record id="excep_wrong_total_amount_tax" model="exception.rule">
            <field name="name">Total Tax Amount differs from Walmart</field>
            <field name="description">The tax amount computed in Odoo doesn't match with the tax amount in Walmart.

Cause:
The taxes are probably different between Odoo and Walmart. A fiscal position could have changed the final price.

Resolution:
Check your taxes and fiscal positions configuration and correct them if necessary.</field>
            <field name="sequence">30</field>
            <field name="model">sale.order</field>
            <field name="rule_group">sale</field>
            <field name="code"># By default, a cent of difference for the tax amount is allowed, feel free to customise it in your own module
if sale.walmart_bind_ids and abs(sale.amount_tax - sale.walmart_bind_ids[0].total_amount_tax) > 0.01:
    failed = True</field>
            <field name="active" eval="True"/>
        </record>

    </data>
</odoo>
