Skip to Content
Menu
This question has been flagged
2794 Views

Good Morning, All.

I have been playing with the creation of a custom module, in an effort to display changes to the sale order report, that fit how my customers wish to see a quotation.

Basically, I've inherited the sale module and attempted to add the 'Internal Category' from the product module in a column.

This is what I have so far:

__init__.py

# -*- coding: utf-8 -*-
import controllers
import models
# from .import modify_type_quotation

__openerp__.py

# -*- coding: utf-8 -*-
{

'name': "Module name",

'summary': """

Sale Order/Quotation with Internal Categories listed""",

'description': """
        Long description of module's purpose
    """,

'category': 'Sales Management',
    'version': '0.4',

'depends': ['base', 'sale', 'product'],

 'data': [

'templatesv2.xml',
    ],

}

models.py

# -*- coding: utf-8 -*-

from openerp import models, fields, api

class add_intcat(models.Model):
 #Inherits the model product.template
 _inherit = 'product.template'

 _name = 'add_intcat.add_intcat'

templatesv2.xml

<openerp>
    <data>
        <!-- Inherit quotation report (from module sale) -->
  <template id="report_quotation_inherit_demo" inherit_id="sale.report_saleorder_document">
  <xpath expr="//div[@class='col-xs-6']//div//strong[1]" position="replace">
            <strong t-if="o.partner_shipping_id == o.partner_invoice_id">Requesting Business Unit/Customer:</strong>
        </xpath>
    <xpath expr="//table[@class='table table-condensed']//thead//tr" position="replace">
    <tr style ="background-color:lightgray;">
     <th>Description</th>
     <th>Internal Category</th>
     <th>Taxes</th>
     <th class="text-right">Quantity</th>
     <th class="text-right">Unit Price</th>
     <th groups="sale.group_discount_per_so_line">Disc.(%)</th>
     <th class="text-right">Price</th>
    </tr>
  </xpath>
  <xpath expr="//tbody[@class='sale_tbody']//tr" position="replace">
   <tr t-foreach="o.order_line" t-as="l">
                <td>
                    <span t-field="l.name"/>
                </td>
                <td>
     <!-- Place holder for 'Internal Category' -->
     <span t-field="product_template.categ_id"/>
    </td>
    <td>
                    <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
                </td>
                <td class="text-right">
                    <span t-field="l.product_uom_qty"/>
                    <span groups="product.group_uom" t-field="l.product_uom"/>
                </td>
                <td class="text-right">
                    <span t-field="l.price_unit"/>
                </td>
                <td groups="sale.group_discount_per_so_line">
                    <span t-field="l.discount"/>
                </td>
                <td class="text-right">
                    <span t-field="l.price_subtotal"
                        t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                </td>
            </tr>
  </xpath>
  </template>
 </data>
</openerp>

So, I know that I'm missing parts to make this print a complete quotation, sale order, what am I missing here?

Avatar
Discard