website_visitor_views.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo><data>
  3. <!--page history-->
  4. <record id="website_visitor_page_view_tree" model="ir.ui.view">
  5. <field name="name">website.track.view.tree</field>
  6. <field name="model">website.track</field>
  7. <field name="arch" type="xml">
  8. <tree string="Visitor Page Views History" create="0">
  9. <field name="visitor_id"/>
  10. <field name="page_id"/>
  11. <field name="url"/>
  12. <field name="visit_datetime"/>
  13. </tree>
  14. </field>
  15. </record>
  16. <record id="website_visitor_page_view_graph" model="ir.ui.view">
  17. <field name="name">website.track.view.graph</field>
  18. <field name="model">website.track</field>
  19. <field name="arch" type="xml">
  20. <graph string="Visitor Page Views" sample="1">
  21. <field name="url"/>
  22. </graph>
  23. </field>
  24. </record>
  25. <record id="website_visitor_page_view_search" model="ir.ui.view">
  26. <field name="name">website.track.view.search</field>
  27. <field name="model">website.track</field>
  28. <field name="arch" type="xml">
  29. <search string="Search Visitor">
  30. <field name="visitor_id"/>
  31. <field name="page_id"/>
  32. <field name="url"/>
  33. <field name="visit_datetime"/>
  34. <filter string="Pages" name="type_page" domain="[('page_id', '!=', False)]"/>
  35. <filter string="Urls &amp; Pages" name="type_url" domain="[('url', '!=', False)]"/>
  36. <group string="Group By">
  37. <filter string="Visitor" name="group_by_visitor" domain="[]" context="{'group_by': 'visitor_id'}"/>
  38. <filter string="Page" name="group_by_page" domain="[]" context="{'group_by': 'page_id'}"/>
  39. <filter string="Url" name="group_by_url" domain="[]" context="{'group_by': 'url'}"/>
  40. <filter string="Date" name="group_by_date" domain="[]" context="{'group_by': 'visit_datetime'}"/>
  41. </group>
  42. </search>
  43. </field>
  44. </record>
  45. <record id="website_visitor_page_action" model="ir.actions.act_window">
  46. <field name="name">Page Views History</field>
  47. <field name="res_model">website.track</field>
  48. <field name="view_mode">tree</field>
  49. <field name="view_ids" eval="[(5, 0, 0),
  50. (0, 0, {'view_mode': 'tree', 'view_id': ref('website_visitor_page_view_tree')}),
  51. (0, 0, {'view_mode': 'graph', 'view_id': ref('website_visitor_page_view_graph')}),
  52. ]"/>
  53. <field name="domain">[('visitor_id', '=', active_id), ('url', '!=', False)]</field>
  54. <field name="help" type="html">
  55. <p class="o_view_nocontent_empty_folder">
  56. No page views yet for this visitor
  57. </p>
  58. </field>
  59. </record>
  60. <!--Website visitor actions-->
  61. <record id="website.visitor_partner_action" model="ir.actions.act_window">
  62. <field name="name">Partners</field>
  63. <field name="res_model">res.partner</field>
  64. <field name="view_mode">tree,form</field>
  65. <field name="domain">[('visitor_ids', 'in', [active_id])]</field>
  66. <field name="help" type="html">
  67. <p class="o_view_nocontent_empty_folder">
  68. No partner linked for this visitor
  69. </p>
  70. </field>
  71. </record>
  72. <!-- website visitor views -->
  73. <record id="website_visitor_view_kanban" model="ir.ui.view">
  74. <field name="name">website.visitor.view.kanban</field>
  75. <field name="model">website.visitor</field>
  76. <field name="arch" type="xml">
  77. <kanban class="o_wvisitor_kanban" sample="1">
  78. <field name="id"/>
  79. <field name="country_id"/>
  80. <field name="country_flag"/>
  81. <field name="email"/>
  82. <field name="is_connected"/>
  83. <field name="display_name"/>
  84. <field name="last_visited_page_id"/>
  85. <field name="page_ids"/>
  86. <field name="partner_id"/>
  87. <field name="partner_image"/>
  88. <templates>
  89. <t t-name="kanban-box">
  90. <div class="oe_kanban_global_click o_wvisitor_kanban_card">
  91. <!-- displayed in ungrouped mode -->
  92. <div class="o_kanban_detail_ungrouped row mx-0">
  93. <div class="col-lg-2 col-sm-8 col-12 py-0 my-2 my-lg-0">
  94. <div class="d-flex">
  95. <div class="o_wvisitor_kanban_image me-3">
  96. <img t-if="record.partner_image.raw_value"
  97. t-att-src="kanban_image('res.partner', 'avatar_128', record.partner_id.raw_value)"
  98. width="54px" height="54px" alt="Visitor"/>
  99. <img t-else=""
  100. t-attf-src="/base/static/img/avatar_grey.png"
  101. width="54px" height="54px" alt="Visitor"/>
  102. </div>
  103. <div class="o_wvisitor_name d-flex flex-grow-1 flex-column my-0 my-lg-2">
  104. <div class="d-flex align-items-start">
  105. <b><field name="display_name"/></b>
  106. <span t-if="record.is_connected.raw_value" class="fa fa-circle text-success ms-2 my-1" aria-label="Online" title="Online"/>
  107. <span t-else="" class="fa fa-circle text-danger ms-2 my-1" aria-label="Offline" title="Offline"/>
  108. </div>
  109. <!-- Double check is necessary for sample view (or error image are shown) -->
  110. <div t-if="record.country_id.raw_value and record.country_flag.raw_value">
  111. <img t-att-src="record.country_flag.raw_value"
  112. class="o_country_flag" alt="Country"/>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="col-lg col-sm-4 col-6 py-0 my-2">
  118. <b><field name="time_since_last_action"/></b>
  119. <div>Last Action</div>
  120. </div>
  121. <div class="col-lg col-sm-4 col-6 py-0 my-2">
  122. <b><field name="visit_count"/></b>
  123. <div>Visits</div>
  124. </div>
  125. <div class="col-lg col-sm-4 col-6 py-0 my-2">
  126. <span t-att-class="record.page_count.raw_value ? 'fw-bold' : 'text-muted'">
  127. <field name="last_visited_page_id"/>
  128. </span>
  129. <div t-att-class="record.page_count.raw_value ? '' : 'text-muted'">Last Page</div>
  130. </div>
  131. <div id="wvisitor_visited_page" class="col-lg col-sm-4 col-6 py-0 my-2">
  132. <span t-att-class="record.page_count.raw_value ? 'fw-bold' : 'text-muted'">
  133. <field name="page_count"/>
  134. </span>
  135. <div t-att-class="record.page_count.raw_value ? '' : 'text-muted'">Visited Pages</div>
  136. </div>
  137. <div class="w_visitor_kanban_actions_ungrouped col-lg-3 col-sm-12 py-0 my-2 text-lg-end">
  138. <button name="action_send_mail" type="object"
  139. class="btn btn-secondary border" attrs="{'invisible': [('email', '=', False)]}">
  140. Email
  141. </button>
  142. </div>
  143. </div>
  144. <!-- displayed in grouped mode -->
  145. <div class="oe_kanban_details">
  146. <div class="float-end">
  147. <span class="fa fa-circle text-success" t-if="record.is_connected.raw_value" aria-label="Online" title="Online"/>
  148. <span class="fa fa-circle text-danger" t-else="" aria-label="Offline" title="Offline"/>
  149. </div>
  150. <strong>
  151. <img t-if="record.country_id.raw_value"
  152. t-att-src="record.country_flag.raw_value"
  153. class="o_country_flag" alt="Country"/>
  154. <field name="display_name"/>
  155. </strong>
  156. <div class="mb-2">Active <field name="time_since_last_action"/></div>
  157. <div t-if="record.page_count.raw_value">Last Page<span class="float-end fw-bold"><field name="last_visited_page_id"/></span></div>
  158. <div>Visits<span class="float-end fw-bold"><field name="visit_count"/></span></div>
  159. <div t-if="record.page_count.raw_value" id="o_page_count">Visited Pages<span class="float-end fw-bold"><field name="page_count"/></span></div>
  160. <div class="w_visitor_kanban_actions">
  161. <button name="action_send_mail" type="object"
  162. class="btn btn-secondary" attrs="{'invisible': [('email', '=', False)]}">
  163. Email
  164. </button>
  165. </div>
  166. </div>
  167. </div>
  168. </t>
  169. </templates>
  170. </kanban>
  171. </field>
  172. </record>
  173. <record id="website_visitor_view_form" model="ir.ui.view">
  174. <field name="name">website.visitor.view.form</field>
  175. <field name="model">website.visitor</field>
  176. <field name="arch" type="xml">
  177. <form string="Website Visitor">
  178. <header>
  179. <button name="action_send_mail" type="object" class="btn btn-primary"
  180. attrs="{'invisible': [('email', '=', False)]}" string="Send Email"/>
  181. </header>
  182. <sheet>
  183. <div class="oe_button_box" name="button_box">
  184. <button class="oe_stat_button o_stat_button_info" disabled="1" attrs="{'invisible': [('is_connected', '=', False)]}">
  185. <i class="fa fa-fw o_button_icon fa-circle text-success"/>
  186. <span>Connected</span>
  187. </button>
  188. <button class="oe_stat_button o_stat_button_info" disabled="1" attrs="{'invisible': [('is_connected', '=', True)]}">
  189. <i class="fa fa-fw o_button_icon fa-circle text-danger"/>
  190. <span>Offline</span>
  191. </button>
  192. <button id="w_visitor_visit_counter" class="oe_stat_button o_stat_button_info" disabled="1" icon="fa-globe">
  193. <field name="visit_count" widget="statinfo" string="Visits"/>
  194. </button>
  195. <button name="%(website.website_visitor_page_action)d" type="action"
  196. class="oe_stat_button"
  197. icon="fa-tags">
  198. <field name="visitor_page_count" widget="statinfo" string="Page Views"/>
  199. </button>
  200. </div>
  201. <div class="float-end" attrs="{'invisible': [('country_id', '=', False)]}">
  202. <field name="country_flag" widget="image_url" options='{"size": [32, 32]}'/>
  203. </div>
  204. <div class="oe_title">
  205. <h1><field name="display_name"/></h1>
  206. </div>
  207. <group id="general_info">
  208. <group string="Details">
  209. <field name="is_connected" invisible="1"/>
  210. <field name="partner_id"/>
  211. <field name="email"/>
  212. <field name="mobile" class="o_force_ltr"/>
  213. <field name="country_id" attrs="{'invisible': [('country_id', '=', False)]}"/>
  214. <field name="lang_id"/>
  215. </group>
  216. <group id="visits" string="Visits">
  217. <field name="website_id" groups="website.group_multi_website"/>
  218. <field name="create_date"/>
  219. <field name="last_connection_datetime"/>
  220. <field name="page_ids" string="Pages" widget="many2many_tags"/>
  221. </group>
  222. </group>
  223. </sheet>
  224. </form>
  225. </field>
  226. </record>
  227. <record id="website_visitor_view_tree" model="ir.ui.view">
  228. <field name="name">website.visitor.view.tree</field>
  229. <field name="model">website.visitor</field>
  230. <field name="arch" type="xml">
  231. <tree string="Web Visitors" decoration-success="is_connected" sample="1">
  232. <field name="country_flag" widget="image_url" options='{"size": [20, 20]}' nolabel="1"/>
  233. <field name="display_name" string="Name"/>
  234. <field name="create_date" optional="hide"/>
  235. <field name="last_connection_datetime"/>
  236. <field name="lang_id"/>
  237. <field name="country_id" optional="hide"/>
  238. <field name="visit_count"/>
  239. <field name="page_ids" widget="many2many_tags" string="Pages"/>
  240. <field name="last_visited_page_id" string="Last Page" optional="hide"/>
  241. <field name="is_connected" invisible="1"/>
  242. <field name="email" invisible="1"/>
  243. <button string="Email" name="action_send_mail" type="object"
  244. icon="fa-envelope" attrs="{'invisible': [('email', '=', False)]}"/>
  245. </tree>
  246. </field>
  247. </record>
  248. <record id="website_visitor_view_search" model="ir.ui.view">
  249. <field name="name">website.visitor.view.search</field>
  250. <field name="model">website.visitor</field>
  251. <field name="arch" type="xml">
  252. <search string="Search Visitor">
  253. <field name="name"/>
  254. <field name="lang_id"/>
  255. <field name="country_id"/>
  256. <field name="visit_count"/>
  257. <field name="page_ids"/>
  258. <filter string="Last 7 Days" name="filter_last_7_days" domain="[('last_connection_datetime', '&gt;', datetime.datetime.now() - datetime.timedelta(days=7))]"/>
  259. <separator/>
  260. <filter string="Unregistered" name="filter_type_visitor" domain="[('partner_id', '=', False)]"/>
  261. <filter string="Contacts" name="filter_type_customer" domain="[('partner_id', '!=', False)]"/>
  262. <separator/>
  263. <filter string="Connected" name="filter_is_connected" domain="[('last_connection_datetime', '&gt;', datetime.datetime.now() - datetime.timedelta(minutes=5))]"/>
  264. <separator/>
  265. <group string="Group By">
  266. <filter string="Country" name="group_by_country" context="{'group_by': 'country_id'}"/>
  267. <filter string="Timezone" name="group_by_timezone" context="{'group_by': 'timezone'}"/>
  268. <filter string="Language" name="group_by_lang" context="{'group_by': 'lang_id'}"/>
  269. <filter string="# Visits" name="group_by_visit_count" context="{'group_by': 'visit_count'}"/>
  270. <filter string="Website" name="group_by_website_id" context="{'group_by': 'website_id'}" groups="website.group_multi_website"/>
  271. <filter string="First Connection" name="group_by_create_date" context="{'group_by': 'create_date'}"/>
  272. <filter string="Last Connection" name="group_by_last_connection_datetime" context="{'group_by': 'last_connection_datetime'}"/>
  273. </group>
  274. </search>
  275. </field>
  276. </record>
  277. <record id="website_visitor_view_graph" model="ir.ui.view">
  278. <field name="name">website.visitor.view.graph</field>
  279. <field name="model">website.visitor</field>
  280. <field name="arch" type="xml">
  281. <graph string="Visitors" type="line" sample="1">
  282. <field name="last_connection_datetime" interval="day"/>
  283. </graph>
  284. </field>
  285. </record>
  286. <record id="website_visitors_action" model="ir.actions.act_window">
  287. <field name="name">Visitors</field>
  288. <field name="type">ir.actions.act_window</field>
  289. <field name="res_model">website.visitor</field>
  290. <field name="view_mode">kanban,tree,form,graph</field>
  291. <field name="context">{'search_default_filter_last_7_days':1}</field>
  292. <field name="help" type="html">
  293. <p class="o_view_nocontent_smiling_face">
  294. No Visitors yet!
  295. </p><p>
  296. Wait for visitors to come to your website to see their history and engage with them.
  297. </p>
  298. </field>
  299. </record>
  300. <record id="website_visitor_track_view_tree" model="ir.ui.view">
  301. <field name="name">website.track.view.tree</field>
  302. <field name="model">website.track</field>
  303. <field name="arch" type="xml">
  304. <tree string="Visitor Views History" create="0" edit="0" sample="1">
  305. <field name="visitor_id"/>
  306. <field name="page_id"/>
  307. <field name="url"/>
  308. <field name="visit_datetime"/>
  309. </tree>
  310. </field>
  311. </record>
  312. <record id="website_visitor_track_view_graph" model="ir.ui.view">
  313. <field name="name">website.track.view.graph</field>
  314. <field name="model">website.track</field>
  315. <field name="arch" type="xml">
  316. <graph string="Visitor Views" sample="1">
  317. <field name="url"/>
  318. </graph>
  319. </field>
  320. </record>
  321. <record id="website_visitor_view_action" model="ir.actions.act_window">
  322. <field name="name">Page Views</field>
  323. <field name="type">ir.actions.act_window</field>
  324. <field name="res_model">website.track</field>
  325. <field name="view_mode">tree</field>
  326. <field name="context">{'search_default_type_url': 1, 'create': False, 'edit': False, 'copy': False}</field>
  327. <field name="view_ids" eval="[(5, 0, 0),
  328. (0, 0, {'view_mode': 'tree', 'view_id': ref('website_visitor_track_view_tree')}),
  329. (0, 0, {'view_mode': 'graph', 'view_id': ref('website_visitor_track_view_graph')}),
  330. ]"/>
  331. <field name="help" type="html">
  332. <p class="o_view_nocontent_smiling_face">
  333. Wait for visitors to come to your website to see the pages they viewed.
  334. </p>
  335. </field>
  336. </record>
  337. <menuitem id="website_visitor_menu" name="Visitors"
  338. sequence="40"
  339. parent="website.menu_reporting"
  340. action="website.website_visitors_action"/>
  341. <menuitem id="menu_visitor_view_menu" name="Page Views"
  342. sequence="50"
  343. parent="website.menu_reporting"
  344. action="website.website_visitor_view_action"/>
  345. </data></odoo>