Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

multipy moq and product price in custom module?

By
Jothimani
on 4/10/14, 7:25 AM 834 views

Hi, i did a new custom module. in my module, i want to calculate revenue from minimum order quantity (moq) and product price; and i want to store the revenue result in a field.

here is my module codes..

__init__.py

import sample

__openerp__.py

{
    'name': 'Testing Purpose',
    'version': '1000.000',
    'author': 'Jothimani.R',
    'category': 'Testing',
    'depends': ['base','product'],
    'demo': ['sample_view.xml'],
    'data': ['sample_view.xml'],
    'test': ['sample_view.xml'],
    'installable': True,
    'auto_install': False,

}

sample.py

from openerp.osv import osv, fields

class sample_work(osv.osv):
    _name = "testing_purpose"
    _description = "Testing Purpose"
    _columns = {
             'number':fields.integer('MOQ', size=3),
             'price_total':fields.float('Price'),
             'product':fields.many2one('product.product','Product', required=True),
             }
sample_work()

sample_view.xml

    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
    <data>
        <record id="sample_form_view" model="ir.ui.view">
        <field name="name">sample.form_view</field>
        <field name="model">testing_purpose</field>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <form string="Testiing purpose form view">
                <field name="number"/>
                <field name="price_total"/>
                <field name="product"/> 
            </form>
        </field>
        </record>

        <record id="sample_tree_view" model="ir.ui.view">
        <field name="name">sample.tree_view</field>
        <field name="model">testing_purpose</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Testiing purpose tree view">
                <field name="number"/>
                <field name="price_total"/>
                <field name="product"/>                                     
            </tree>
        </field>
        </record>

        <record id="test-purpose" model="ir.actions.act_window">
            <field name="name">Testing Purpo</field>
            <field name="res_model">testing_purpose</field>
            <field name="view_type">form</field>
            <field name="view_mode">list,form</field>
        </record>

        <menuitem
        id="parent_menu"
        name="Testing"
        sequence="1"/>

        <menuitem
        id="sub_menu"
        name="Operations"
        parent="parent_menu"/>

        <menuitem
        action="test-purpose"
        id="sub2_menu"
        name="Sample_Purpose"
        parent="sub_menu"/>

</data></openerp>

hi, please anyone help me........

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/10/14, 7:25 AM
Seen: 834 times
Last updated: 3/16/15, 8:10 AM