portal_templates.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <template id="portal_my_home_menu_purchase" name="Portal layout : purchase menu entries" inherit_id="portal.portal_breadcrumbs" priority="25">
  4. <xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
  5. <li t-if="page_name == 'rfq' or order and order.state == 'sent'" t-attf-class="breadcrumb-item #{'active ' if not order else ''}">
  6. <a t-if="order" t-attf-href="/my/rfq?{{ keep_query() }}">Requests for Quotation</a>
  7. <t t-else="">Requests for Quotation</t>
  8. </li>
  9. <li t-if="page_name == 'purchase' or order and order.state != 'sent'" t-attf-class="breadcrumb-item #{'active ' if not order else ''}">
  10. <a t-if="order" t-attf-href="/my/purchase?{{ keep_query() }}">Purchase Orders</a>
  11. <t t-else="">Purchase Orders</t>
  12. </li>
  13. <li t-if="order" class="breadcrumb-item active">
  14. <t t-esc="order.name"/>
  15. </li>
  16. </xpath>
  17. </template>
  18. <template id="portal_my_home_purchase" name="Show Requests for Quotation / Purchase Orders" customize_show="True" inherit_id="portal.portal_my_home" priority="25">
  19. <xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
  20. <t t-call="portal.portal_docs_entry">
  21. <t t-set="title">Requests for Quotation</t>
  22. <t t-set="url" t-value="'/my/rfq'"/>
  23. <t t-set="placeholder_count" t-value="'rfq_count'"/>
  24. </t>
  25. <t t-call="portal.portal_docs_entry">
  26. <t t-set="title">Purchase Orders</t>
  27. <t t-set="url" t-value="'/my/purchase'"/>
  28. <t t-set="placeholder_count" t-value="'purchase_count'"/>
  29. </t>
  30. </xpath>
  31. </template>
  32. <template id="portal_my_purchase_rfqs" name="My Requests For Quotation">
  33. <t t-call="portal.portal_layout">
  34. <t t-set="breadcrumbs_searchbar" t-value="True"/>
  35. <t t-call="portal.portal_searchbar">
  36. <t t-set="title" >Requests For Quotation</t>
  37. </t>
  38. <t t-if="not rfqs">
  39. <p>There are currently no requests for quotation for your account.</p>
  40. </t>
  41. <t t-if="rfqs" t-call="portal.portal_table">
  42. <thead>
  43. <tr class="active">
  44. <th>
  45. <span class='d-none d-md-inline'>Request for Quotation #</span>
  46. <span class='d-block d-md-none'>Ref.</span>
  47. </th>
  48. <th class="text-end">Order Deadline</th>
  49. <th class="text-end">Total</th>
  50. </tr>
  51. </thead>
  52. <t t-foreach="rfqs" t-as="rfq">
  53. <tr>
  54. <td><a t-att-href="rfq.get_portal_url()"><t t-esc="rfq.name"/></a></td>
  55. <td class="text-end">
  56. <span t-field="rfq.date_order" t-options="{'widget': 'date'}"/>&amp;nbsp;
  57. <span class='d-none d-md-inline' t-field="rfq.date_order" t-options="{'time_only': True}"/>
  58. </td>
  59. <td class="text-end">
  60. <span t-field="rfq.amount_total"/>
  61. </td>
  62. </tr>
  63. </t>
  64. </t>
  65. </t>
  66. </template>
  67. <template id="portal_my_purchase_orders" name="My Purchase Orders">
  68. <t t-call="portal.portal_layout">
  69. <t t-set="breadcrumbs_searchbar" t-value="True"/>
  70. <t t-call="portal.portal_searchbar">
  71. <t t-set="title">Purchase Orders</t>
  72. </t>
  73. <t t-if="not orders">
  74. <p>There are currently no purchase orders for your account.</p>
  75. </t>
  76. <t t-if="orders" t-call="portal.portal_table">
  77. <thead>
  78. <tr class="active">
  79. <th>
  80. <span class='d-none d-md-inline'>Purchase Order #</span>
  81. <span class='d-block d-md-none'>Ref.</span>
  82. </th>
  83. <th class="text-end">
  84. <span class='d-none d-md-inline'>Confirmation Date</span>
  85. <span class='d-block d-md-none'>Confirmation</span>
  86. </th>
  87. <th class="text-center"/>
  88. <th class="text-end">Total</th>
  89. </tr>
  90. </thead>
  91. <t t-foreach="orders" t-as="order">
  92. <tr>
  93. <td><a t-att-href="order.get_portal_url()"><t t-esc="order.name"/></a></td>
  94. <td class="text-end">
  95. <span t-field="order.date_approve" t-options="{'widget': 'date'}"/>&amp;nbsp;
  96. <span class='d-none d-md-inline' t-field="order.date_approve" t-options="{'time_only': True}"/>
  97. </td>
  98. <td class="text-center">
  99. <span t-if="order.invoice_status == 'to invoice'" class="badge rounded-pill text-bg-info">
  100. <i class="fa fa-fw fa-file-text" role="img" aria-label="Waiting for Bill" title="Waiting for Bill"></i><span class="d-none d-md-inline"> Waiting for Bill</span>
  101. </span>
  102. <span t-if="order.state == 'cancel'" class="badge rounded-pill text-bg-secondary">
  103. <i class="fa fa-fw fa-remove" role="img" aria-label="Cancelled" title="Cancelled"></i><span class="d-none d-md-inline"> Cancelled</span>
  104. </span>
  105. <span t-if="order.state == 'done'" class="badge rounded-pill text-bg-success">
  106. <i class="fa fa-fw fa-check" role="img" aria-label="Done" title="Done"></i><span class="d-none d-md-inline"> Done</span>
  107. </span>
  108. </td>
  109. <td class="text-end"><span t-field="order.amount_total"/></td>
  110. </tr>
  111. </t>
  112. </t>
  113. </t>
  114. </template>
  115. <template id="portal_my_purchase_order" name="Purchase Order Portal Template" inherit_id="portal.portal_sidebar" primary="True">
  116. <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
  117. <t t-set="o_portal_fullwidth_alert" groups="purchase.group_purchase_manager">
  118. <t t-call="portal.portal_back_in_edit_mode">
  119. <t t-set="backend_url" t-value="'/web#model=%s&amp;id=%s&amp;action=%s&amp;view_type=form' % (order._name, order.id, order.env.ref('purchase.purchase_rfq').id)"/>
  120. </t>
  121. </t>
  122. <div class="row mt16 o_portal_purchase_sidebar">
  123. <!-- Sidebar -->
  124. <t t-call="portal.portal_record_sidebar">
  125. <t t-set="classes" t-value="'col-lg-auto d-print-none'"/>
  126. <t t-set="title">
  127. <h2 class="mb-0"><b t-field="order.amount_total" data-id="total_amount"/> </h2>
  128. </t>
  129. <t t-set="entries">
  130. <ul class="list-group list-group-flush flex-wrap flex-row flex-lg-column">
  131. <li class="list-group-item flex-grow-1">
  132. <div class="o_download_pdf btn-toolbar flex-sm-nowrap">
  133. <div class="btn-group flex-grow-1 me-1 mb-1">
  134. <a class="btn btn-secondary btn-block o_download_btn" t-att-href="order.get_portal_url(report_type='pdf', download=True)" title="Download"><i class="fa fa-download"/> Download</a>
  135. </div>
  136. <div class="btn-group flex-grow-1 mb-1">
  137. <a class="btn btn-secondary btn-block o_print_btn o_portal_invoice_print" t-att-href="order.get_portal_url(report_type='pdf')" id="print_invoice_report" title="Print" target="_blank"><i class="fa fa-print"/> Print</a>
  138. </div>
  139. </div>
  140. </li>
  141. <li class="navspy list-group-item ps-0 flex-grow-1" t-ignore="true" role="complementary">
  142. <ul class="nav flex-column bs-sidenav"></ul>
  143. </li>
  144. <li t-if="order.user_id" class="list-group-item flex-grow-1">
  145. <div class="small mb-1"><strong class="text-muted">Purchase Representative</strong></div>
  146. <div class="row flex-nowrap">
  147. <div class="col flex-grow-0 pe-2">
  148. <img class="rounded-circle mr4 float-start o_portal_contact_img" t-att-src="image_data_uri(order.user_id.avatar_1024)" alt="Contact"/>
  149. </div>
  150. <div class="col ps-0" style="min-width: 150px">
  151. <span t-field="order.user_id" t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True}'/>
  152. <a href="#discussion" class="small"><i class="fa fa-comment"></i> Send message</a>
  153. </div>
  154. </div>
  155. </li>
  156. </ul>
  157. </t>
  158. </t>
  159. <!-- Page content -->
  160. <div id="quote_content" class="col-12 col-lg justify-content-end">
  161. <!-- status messages -->
  162. <div t-if="order.state == 'cancel'" class="alert alert-danger alert-dismissable d-print-none" role="alert">
  163. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"></button>
  164. <strong>This purchase has been canceled.</strong>
  165. </div>
  166. <!-- main content -->
  167. <div t-attf-class="card #{'pb-5' if report_type == 'html' else ''}" id="portal_purchase_content">
  168. <div t-call="purchase.purchase_order_portal_content"/>
  169. </div>
  170. <!-- chatter -->
  171. <div id="purchase_order_communication" class="mt-4">
  172. <h2>History</h2>
  173. <t t-call="portal.message_thread"/>
  174. </div>
  175. </div><!-- // #quote_content -->
  176. </div>
  177. </xpath>
  178. </template>
  179. <template id="purchase_order_portal_content" name="Purchase Order Portal Content">
  180. <!-- Intro -->
  181. <div id="introduction" t-attf-class="pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}">
  182. <h2 class="my-0">
  183. <t t-if="order.state in ['draft', 'sent']">Request for Quotation</t>
  184. <t t-else="1">
  185. Purchase Order
  186. </t>
  187. <em t-esc="order.name"/>
  188. </h2>
  189. </div>
  190. <div t-attf-class="#{'card-body' if report_type == 'html' else ''}">
  191. <!-- Informations -->
  192. <div id="informations">
  193. <div class="row" id="po_date">
  194. <div class="mb-3 col-6">
  195. <t t-if="order.state in ['draft', 'sent']">
  196. <strong>Request For Quotation Date:</strong>
  197. </t>
  198. <t t-if="order.state in ['purchase', 'done', 'cancel']">
  199. <strong>Order Date:</strong>
  200. </t>
  201. <span t-field="order.date_order" t-options='{"widget": "date"}'/>
  202. </div>
  203. </div>
  204. <div class="row">
  205. <div class="col-lg-6">
  206. <strong class="d-block mb-1">From:</strong>
  207. <address t-field="order.company_id.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
  208. <strong>Confirmation Date:</strong> <span t-field="order.date_approve" t-options='{"widget": "date"}'/><br/>
  209. <div t-att-class="'d-inline' if order.date_planned else 'd-none'">
  210. <strong>Receipt Date:</strong><span class="ms-1" t-field="order.date_planned" t-options='{"widget": "date"}'/>
  211. </div>
  212. </div>
  213. </div>
  214. <t t-set="invoices" t-value="[i for i in order.invoice_ids if i.state not in ['draft', 'cancel']]"/>
  215. <div t-if="invoices" class="row">
  216. <div class="col">
  217. <strong class="d-block mb-1">Invoices</strong>
  218. <ul class="list-group mb-4">
  219. <t t-foreach="invoices" t-as="i">
  220. <t t-set="report_url" t-value="i.get_portal_url(report_type='pdf', download=True)"/>
  221. <div class="d-flex flex-wrap align-items-center justify-content-between">
  222. <div>
  223. <a t-att-href="report_url">
  224. <span t-esc="i.name"/>
  225. </a>
  226. <div class="small d-lg-inline-block">Date: <span class="text-muted" t-field="i.invoice_date"/></div>
  227. </div>
  228. <span t-if="i.payment_state in ('paid', 'in_payment')" class="small badge text-bg-success"><i class="fa fa-fw fa-check"/> <b>Paid</b></span>
  229. <span t-else="" class="small badge text-bg-info"><i class="fa fa-fw fa-clock-o"/> <b>Waiting Payment</b></span>
  230. </div>
  231. </t>
  232. </ul>
  233. </div>
  234. </div>
  235. </div>
  236. <section id="details" style="page-break-inside: auto;" class="mt32">
  237. <h3 id="details">Pricing</h3>
  238. <div class="table-responsive">
  239. <table t-att-data-order-id="order.id" t-att-data-token="order.access_token" class="table table-sm" id="purchase_order_table">
  240. <thead class="bg-100">
  241. <tr>
  242. <th class="text-start">Products</th>
  243. <th class="text-end">Quantity</th>
  244. <th t-if="update_dates" class="text-end">Scheduled Date</th>
  245. <th t-if="update_dates" class="text-end"><strong>Update Here</strong></th>
  246. <th t-if="not update_dates and order.state in ['purchase', 'done']" t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}">Unit Price</th>
  247. <th t-if="not update_dates and order.state in ['purchase', 'done']" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  248. <span>Taxes</span>
  249. </th>
  250. <th class="text-end" t-if="order.state in ['purchase', 'done']" >
  251. <span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
  252. <span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
  253. </th>
  254. </tr>
  255. </thead>
  256. <tbody class="purchase_tbody">
  257. <t t-set="current_subtotal" t-value="0"/>
  258. <t t-foreach="order.order_line" t-as="line">
  259. <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
  260. <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
  261. <tr t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'fst-italic text-break' if line.display_type == 'line_note' else ''">
  262. <t t-if="not line.display_type">
  263. <td id="product_name">
  264. <img t-att-src="image_data_uri(resize_to_48(line.product_id.image_1024))" alt="Product" class="d-none d-lg-inline"/>
  265. <span t-field="line.name"/>
  266. </td>
  267. <td class="text-end">
  268. <div id="quote_qty">
  269. <span t-field="line.product_qty"/>
  270. <span t-field="line.product_uom" groups="uom.group_uom"/>
  271. </div>
  272. </td>
  273. <td t-if="update_dates" class="text-end"><span t-esc="line.date_planned.date()"/></td>
  274. <td t-if="update_dates" class="text-end">
  275. <form t-attf-action="/my/purchase/#{order.id}/update?access_token=#{order.access_token}" method="post">
  276. <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
  277. <div class="container">
  278. <div class="mb-3">
  279. <div class="input-group date">
  280. <input type="text" class="form-control datetimepicker-input o-purchase-datetimepicker" t-attf-id="datetimepicker_#{line.id}" t-att-name="line.id"
  281. data-toggle="datetimepicker" data-date-format="YYYY-MM-DD" t-attf-data-target="#datetimepicker_#{line.id}"/>
  282. </div>
  283. </div>
  284. </div>
  285. </form>
  286. </td>
  287. <td t-if="not update_dates and order.state in ['purchase', 'done']" t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}">
  288. <div
  289. t-field="line.price_unit"
  290. class="text-end"
  291. />
  292. </td>
  293. <td t-if="not update_dates and order.state in ['purchase', 'done']" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
  294. <span t-esc="', '.join(map(lambda x: (x.description or x.name), line.taxes_id))"/>
  295. </td>
  296. <td class="text-end" t-if="not update_dates and order.state in ['purchase', 'done']">
  297. <span class="oe_order_line_price_subtotal" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
  298. <span class="oe_order_line_price_total" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
  299. </td>
  300. </t>
  301. <t t-if="line.display_type == 'line_section'">
  302. <td colspan="99">
  303. <span t-field="line.name"/>
  304. </td>
  305. <t t-set="current_section" t-value="line"/>
  306. <t t-set="current_subtotal" t-value="0"/>
  307. </t>
  308. <t t-if="line.display_type == 'line_note'">
  309. <td colspan="99">
  310. <span t-field="line.name"/>
  311. </td>
  312. </t>
  313. </tr>
  314. <t t-if="current_section and (line_last or order.order_line[line_index+1].display_type == 'line_section') and order.state in ['purchase', 'done']">
  315. <tr class="is-subtotal text-end">
  316. <td colspan="99">
  317. <strong class="mr16">Subtotal</strong>
  318. <span
  319. t-esc="current_subtotal"
  320. t-options='{"widget": "monetary", "display_currency": order.currency_id}'
  321. />
  322. </td>
  323. </tr>
  324. </t>
  325. </t>
  326. </tbody>
  327. </table>
  328. </div>
  329. <div id="total" t-if="order.state in ['purchase', 'done']" class="row" name="total" style="page-break-inside: avoid;">
  330. <div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ms-auto">
  331. <t t-call="purchase.purchase_order_portal_content_totals_table"/>
  332. </div>
  333. </div>
  334. </section>
  335. <section id="terms" class="mt-5" t-if="order.notes">
  336. <h3 class="">Terms &amp; Conditions</h3>
  337. <hr class="mt-0 mb-1"/>
  338. <em t-field="order.notes"/>
  339. </section>
  340. <section class="mt-5" t-if="order.payment_term_id">
  341. <h3 class="">Payment terms</h3>
  342. <hr class="mt-0 mb-1"/>
  343. <span t-field="order.payment_term_id"/>
  344. </section>
  345. </div>
  346. </template>
  347. <template id="purchase_order_portal_content_totals_table">
  348. <table class="table table-sm">
  349. <t t-set="tax_totals" t-value="order.tax_totals"/>
  350. <t t-call="account.document_tax_totals"/>
  351. </table>
  352. </template>
  353. <template id="portal_my_purchase_order_update_date" name="Portal: My Purchase Order Update Dates" inherit_id="purchase.portal_my_purchase_order" primary="True">
  354. <xpath expr="////div[@id='portal_purchase_content']" position="replace">
  355. <div t-attf-class="card #{'pb-5' if report_type == 'html' else ''}" id="portal_purchase_content">
  356. <t t-set="update_dates" t-value="True"/>
  357. <div t-call="purchase.purchase_order_portal_content"/>
  358. </div>
  359. </xpath>
  360. </template>
  361. </odoo>