You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
4.4 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <openerp>
  3. <data>
  4. <record id="view_import_odoo_database_tree" model="ir.ui.view">
  5. <field name="model">import.odoo.database</field>
  6. <field name="arch" type="xml">
  7. <tree>
  8. <field name="url" />
  9. <field name="database" />
  10. </tree>
  11. </field>
  12. </record>
  13. <record id="view_import_odoo_database_form" model="ir.ui.view">
  14. <field name="model">import.odoo.database</field>
  15. <field name="arch" type="xml">
  16. <form>
  17. <header>
  18. <button type="object" name="action_import" string="Run import" class="oe_highlight" attrs="{'invisible': [('cronjob_running', '=', True)]}" />
  19. <button type="object" name="exists" string="Refresh" class="oe_highlight" attrs="{'invisible': [('cronjob_running', '=', False)]}" />
  20. <field name="cronjob_running" invisible="1" />
  21. </header>
  22. <sheet>
  23. <group col="4" name="credentials">
  24. <field name="url" widget="url" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
  25. <field name="database" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
  26. <field name="user" attrs="{'readonly': [('cronjob_running', '=', True)]}" />
  27. <field name="password" password="True" attrs="{'readonly': [('cronjob_running', '=', True)], 'required': [('cronjob_running', '=', False)]}" />
  28. <field name="cronjob_id" attrs="{'invisible': [('cronjob_id', '=', False)]}" />
  29. <field name="status_html" attrs="{'invisible': [('status_html', '=', False)]}" string="Progress" />
  30. </group>
  31. <field name="import_line_ids" attrs="{'readonly': [('cronjob_running', '=', True)]}">
  32. <tree editable="top">
  33. <field name="sequence" widget="handle" />
  34. <field name="model_id" />
  35. <field name="domain" />
  36. </tree>
  37. </field>
  38. <field name="import_field_mappings" attrs="{'readonly': [('cronjob_running', '=', True)]}"/>
  39. </sheet>
  40. </form>
  41. </field>
  42. </record>
  43. <template id="view_import_odoo_database_qweb">
  44. <script type="text/javascript">
  45. function base_import_database_open(model, model_name, database_id)
  46. {
  47. return new openerp.web.Model('ir.model.data')
  48. .query(['res_id'])
  49. .filter([
  50. ['module', '=', 'base_import_odoo'],
  51. ['model', '=', model],
  52. ['import_database_id', '=', database_id],
  53. ])
  54. .all()
  55. .then(function(data)
  56. {
  57. return openerp.webclient.action_manager.do_action({
  58. 'name': model_name,
  59. 'type': 'ir.actions.act_window',
  60. 'views': [[false, 'list'], [false, 'form']],
  61. 'res_model': model,
  62. 'domain': [['id', 'in', _.map(data, function(x) {return x.res_id})]]
  63. });
  64. });
  65. }
  66. </script>
  67. <dl>
  68. <t t-foreach="object.status_data.get('counts', [])" t-as="model_name">
  69. <t t-set="model_display_name" t-value="request.env['ir.model'].search([('model', '=', model_name)]).name" />
  70. <dt t-esc="model_display_name" />
  71. <dd>
  72. <a href="#" t-att-onclick="'base_import_database_open(&quot;%s&quot;, &quot;%s&quot;, %s)' % (model_name, model_display_name, object.id)">
  73. <span t-esc="object.status_data.get('done', {}).get(model_name, 0)" />/<span t-esc="object.status_data['counts'][model_name]" /> done
  74. </a>
  75. </dd>
  76. </t>
  77. </dl>
  78. <t t-if="object.status_data.get('error')"><pre t-esc="object.status_data['error']" /></t>
  79. </template>
  80. </data>
  81. </openerp>