[ADD] better progress
parent
d304d40a90
commit
9543726d5d
|
@ -73,6 +73,8 @@ class TestBaseImportOdoo(TransactionCase):
|
||||||
# TODO: test much more
|
# TODO: test much more
|
||||||
run += 1
|
run += 1
|
||||||
demodb = self.env.ref('base_import_odoo.demodb')
|
demodb = self.env.ref('base_import_odoo.demodb')
|
||||||
|
for line in demodb.import_line_ids:
|
||||||
|
self.assertIn(line.model_id.model, demodb.status_html)
|
||||||
demodb.action_import()
|
demodb.action_import()
|
||||||
self.assertTrue(demodb.cronjob_id)
|
self.assertTrue(demodb.cronjob_id)
|
||||||
demodb.cronjob_id.write({'active': False})
|
demodb.cronjob_id.write({'active': False})
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
<field name="cronjob_running" invisible="1" />
|
<field name="cronjob_running" invisible="1" />
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
|
<field name="status_html" attrs="{'invisible': [('status_html', '=', False)]}" />
|
||||||
<group col="4" name="credentials">
|
<group col="4" name="credentials">
|
||||||
<field name="url" widget="url" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
<field name="url" widget="url" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
||||||
<field name="database" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
<field name="database" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
||||||
<field name="user" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
<field name="user" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
|
||||||
<field name="password" password="True" attrs="{'readonly': [('cronjob_running', '=', True)], 'required': [('cronjob_running', '=', False)]}" />
|
<field name="password" password="True" attrs="{'readonly': [('cronjob_running', '=', True)], 'required': [('cronjob_running', '=', False)]}" />
|
||||||
<field name="cronjob_id" attrs="{'invisible': [('cronjob_id', '=', False)]}" />
|
<field name="cronjob_id" attrs="{'invisible': [('cronjob_id', '=', False)]}" />
|
||||||
<field name="status_html" attrs="{'invisible': [('status_html', '=', False)]}" string="Progress" />
|
|
||||||
</group>
|
</group>
|
||||||
<field name="import_line_ids" attrs="{'readonly': [('cronjob_running', '=', True)]}">
|
<field name="import_line_ids" attrs="{'readonly': [('cronjob_running', '=', True)]}">
|
||||||
<tree editable="top">
|
<tree editable="top">
|
||||||
|
@ -64,17 +64,17 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<dl>
|
<h2>Import progress</h2>
|
||||||
<t t-foreach="object.status_data.get('counts', [])" t-as="model_name">
|
<div style="display: flex;">
|
||||||
<t t-set="model_display_name" t-value="request.env['ir.model'].search([('model', '=', model_name)]).name" />
|
<div style="margin-right: .5em" t-foreach="object.import_line_ids" t-as="import_line">
|
||||||
<dt t-esc="model_display_name" />
|
<t t-set="model_name" t-value="import_line.model_id.model" />
|
||||||
<dd>
|
<t t-set="model_display_name" t-value="import_line.model_id.name" />
|
||||||
<a href="#" t-att-onclick="'base_import_database_open("%s", "%s", %s)' % (model_name, model_display_name, object.id)">
|
<h3 t-esc="model_display_name" />
|
||||||
<span t-esc="object.status_data.get('done', {}).get(model_name, 0)" />/<span t-esc="object.status_data['counts'][model_name]" /> done
|
<a href="#" t-att-onclick="'base_import_database_open("%s", "%s", %s)' % (model_name, model_display_name, object.id)">
|
||||||
</a>
|
<span t-esc="object.status_data.get('done', {}).get(model_name, 0)" />/<span t-esc="object.status_data.get('counts', {}).get(model_name, 0)" /> done
|
||||||
</dd>
|
</a>
|
||||||
</t>
|
</div>
|
||||||
</dl>
|
</div>
|
||||||
<t t-if="object.status_data.get('error')"><pre t-esc="object.status_data['error']" /></t>
|
<t t-if="object.status_data.get('error')"><pre t-esc="object.status_data['error']" /></t>
|
||||||
</template>
|
</template>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue