report_product_labels_wizard.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <openerp>
  3. <data>
  4. <!-- Report for the original Product Label -->
  5. <report
  6. id="report_product_product_label"
  7. string="Product Label"
  8. model="product.product.label"
  9. report_type="qweb-pdf"
  10. file="product_label"
  11. name="product_labels.product_product_label"
  12. />
  13. <record id="report_product_product_label" model="ir.actions.report.xml">
  14. <field name="paperformat_id" ref="product_labels.paperformat_product_label"/>
  15. </record>
  16. <!-- New Report for Product Label with Price -->
  17. <report
  18. id="report_product_product_label_with_price"
  19. string="Product Label with Price"
  20. model="product.product.label"
  21. report_type="qweb-pdf"
  22. file="product_label_with_price"
  23. name="product_labels.product_product_label_with_price"
  24. />
  25. <record id="report_product_product_label_with_price" model="ir.actions.report.xml">
  26. <field name="paperformat_id" ref="product_labels.paperformat_product_label"/>
  27. </record>
  28. <!-- Original Template -->
  29. <template id="product_product_label">
  30. <t t-call="report.html_container">
  31. <t t-foreach="docs" t-as="label">
  32. <t t-foreach="label.label_lines" t-as="line">
  33. <t t-foreach="range(int(line.quantity))" t-as="range_line">
  34. <div class="page">
  35. <div class="oe_structure"/>
  36. <div class="row">
  37. <table style="width: 100%; border: 1px solid black; text-align: center; border-collapse: collapse;">
  38. <tr>
  39. <td colspan="2">
  40. <h5><span t-field="product.display_name"/>
  41. </h5>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td colspan="2">
  46. <span t-if="product.ean13">
  47. <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.ean13, 600, 13)" style="width:70mm; height:13mm;"/>
  48. <h5><span t-esc="product.ean13"/></h5>
  49. </span>
  50. </td>
  51. </tr>
  52. </table>
  53. </div>
  54. </div>
  55. </t>
  56. </t>
  57. </t>
  58. </t>
  59. </template>
  60. <!-- New Template for Label with Price -->
  61. <template id="product_product_label_with_price">
  62. <t t-call="report.html_container">
  63. <t t-foreach="docs" t-as="label">
  64. <t t-foreach="label.label_lines" t-as="line">
  65. <t t-foreach="range(int(line.quantity))" t-as="range_line">
  66. <div class="page">
  67. <div class="oe_structure"/>
  68. <div class="row">
  69. <table style="width: 100%; border: 1px solid black; text-align: center; border-collapse: collapse;">
  70. <tr>
  71. <td colspan="2" style="margin: 0; padding: 0;">
  72. <!-- Verificar que el producto exista antes de mostrar su nombre -->
  73. <t t-if="product.display_name">
  74. <h5 style="margin: 0; padding: 0;">
  75. <span t-field="product.display_name"/>
  76. </h5>
  77. </t>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td colspan="2" style="margin: 0; padding: 0;">
  82. <!-- Verificar que el producto y el precio existan antes de mostrar el precio -->
  83. <t t-if="product and product.lst_price">
  84. <h5 style="margin: 0; padding: 0;">
  85. Precio: <span t-esc="product.lst_price"/>
  86. </h5>
  87. </t>
  88. </td>
  89. </tr>
  90. <tr>
  91. <td colspan="2">
  92. <span t-if="product.ean13">
  93. <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('EAN13', product.ean13, 600, 13)" style="width:70mm; height:13mm;"/>
  94. <h5><span t-esc="product.ean13"/></h5>
  95. </span>
  96. </td>
  97. </tr>
  98. </table>
  99. </div>
  100. </div>
  101. </t>
  102. </t>
  103. </t>
  104. </t>
  105. </template>
  106. </data>
  107. </openerp>