summaryrefslogtreecommitdiff
path: root/addons/product_matrix/views
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/product_matrix/views
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/product_matrix/views')
-rw-r--r--addons/product_matrix/views/assets.xml9
-rw-r--r--addons/product_matrix/views/matrix_templates.xml51
2 files changed, 60 insertions, 0 deletions
diff --git a/addons/product_matrix/views/assets.xml b/addons/product_matrix/views/assets.xml
new file mode 100644
index 00000000..7f0793f8
--- /dev/null
+++ b/addons/product_matrix/views/assets.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <template id="assets_backend_inherit_sale" inherit_id="web.assets_backend" name="Sale Grid assets">
+ <xpath expr="script[last()]" position="after">
+ <script type="text/javascript" src="/product_matrix/static/src/js/section_and_note_widget.js"/>
+ <link rel="stylesheet" type="text/scss" href="/product_matrix/static/src/scss/product_matrix.scss"/>
+ </xpath>
+ </template>
+</odoo>
diff --git a/addons/product_matrix/views/matrix_templates.xml b/addons/product_matrix/views/matrix_templates.xml
new file mode 100644
index 00000000..e4fda487
--- /dev/null
+++ b/addons/product_matrix/views/matrix_templates.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <template id="matrix">
+ <t t-foreach="order.get_report_matrixes()" t-as="grid">
+ <table class="o_view_grid o_product_variant_grid table table-sm table-striped table-bordered">
+ <thead>
+ <tr>
+ <th t-foreach="grid['header']" t-as="column_header" class="o_grid_title_header text-center">
+ <span t-esc="column_header['name']"/>
+ <t t-call="product_matrix.extra_price">
+ <t t-set="price" t-value="column_header.get('price', False)"/>
+ </t>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr t-foreach="grid['matrix']" t-as="row">
+ <t t-foreach="row" t-as="cell">
+ <td t-if="cell.get('name', False)" class="text-left">
+ <strong t-esc="cell['name']"/>
+ <t t-call="product_matrix.extra_price">
+ <t t-set="price" t-value="cell.get('price', False)"/>
+ </t>
+ </td>
+ <td t-else="" class="text-right">
+ <span t-esc="cell.get('qty', 0)" class="o_grid_cell_container"/>
+ </td>
+ </t>
+ </tr>
+ </tbody>
+ </table>
+ </t>
+ </template>
+
+ <template id="extra_price">
+ <span t-if="price" class="badge badge-pill badge-secondary">
+ <!--
+ price_extra is displayed as catalog price instead of
+ price after pricelist because it is impossible to
+ compute. Indeed, the pricelist rule might depend on the
+ selected variant, so the price_extra will be different
+ depending on the selected combination. The price of an
+ attribute is therefore variable and it's not very
+ accurate to display it.
+ -->
+ <span class="variant_price_extra" style="white-space: nowrap;">
+ <t t-raw="price"/>
+ </span>
+ </span>
+ </template>
+</odoo>