right now i am using a module from github, that creates a page in product that lists all the "prices" from product.pricelist of the product. What i want, is to take the "price_list" of the product, and substract the discount in each line.
import math
import re
import logging
import openerp.addons.decimal_precision as dp
#from _common import rounding
from openerp import tools
from openerp.osv import osv, fields
from openerp.tools.translate import _
_logger = logging.getLogger(__name__) # Need for message in console.
class product_template(osv.osv):
_name = 'product.template'
_inherit = 'product.template'
_columns = {
# For display price in product.
'prices_ids': fields.one2many('product.pricelist.item', 'product_id', 'Supplier'),
'price_bas': fields.Char('Display Name', related='price_list.price.bas',store=True),
}
product_template()
class product_pricelist_item(osv.osv):
_name = 'product.pricelist.item'
_inherit = 'product.pricelist.item'
_columns = {
}
product_pricelist_item()
Bold, added by me, making some mistakes. I couldnt get to the point of showing the "price_list" = standard price of the product, into the new price page, yet.
This is the xml.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="price_list_tab_view" model="ir.ui.view">
<field name="name">product.template.product.form</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<xpath expr="/form/sheet/notebook" position="inside" version="7.0">
<page string="Prices" >
<group >
<field name="price.bas"/>
</group>
<group colspan="2" col="2">
<field name="prices_ids" nolabel="1" widget="one2many_list" >
<tree string="Price List">
<field name="price_version_id"/>
<field name="min_quantity"/>
<field name="price_surcharge" string="Descuento"/>
</tree>
</field>
</group>
</page>
</xpath>
</field>
</record>
<!-- it for posible add price from product -->
<record id="price_versionid_form_view" model="ir.ui.view">
<field name="name">product.pricelist.item.form</field>
<field name="model">product.pricelist.item</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_pricelist_item_form_view" />
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position='before'>
<group col="4" string="Price version">
<field name="price_version_id"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>