如何在另一个模块的其他字段中获取一个模块的字段值?

时间:2014-05-20 15:14:04

标签: python xml openerp

我需要您的帮助来解决自定义OpenERP7的问题。 首先,我必须说我是开发人员的初学者,我真的尝试了很多并浏览了其他模块的代码,并在网上搜索了一个例子或解释,并阅读了开发人员指南。

现在我的问题/问题:

我创建了自己的自定义模块,为我们的业务添加了更多字段到购买模块。

现在我需要在stock-module(Incoming Shipments - stock.picking.in)中使用相同的字段(readonly)以及每个订单的相应值。

任何人都可以给我一个建议吗?

这里可以编码:

'__ openerp __ .py'

{
'name' : "ebay Integration (oP)",
'version' : "1.0",
'author' : "zeus",
'category' : "Custom",
'depends' : ['purchase'],
'data' : ['ebay_project.xml'],
'demo' : [],
'installable': True,
'active': True
}    

ebay_project.py

from openerp.osv import fields, osv


class ebay_project(osv.osv):

_name = 'purchase.order'
_inherit = 'purchase.order'

_columns = {
    'x_ebay_id': fields.char('ebay-Auktionsnummer', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_title': fields.char('ebay-Titel', size=64, readonly=False, ondelete="set null", select=1),
    'x_ebay_date': fields.date('ebay-Auktionsende'),
    'x_ebay_sum': fields.char('ebay-Auktionsbetrag', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_seller_username': fields.char('ebay-Verkäuferaccount', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_seller_realname': fields.char('ebay-Verkäufername', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_seller_email': fields.char('ebay-Verkäufer-Mailadresse', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_purchaser': fields.char('ebay-Einkäufer-ID', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_payment_check': fields.boolean('bezahlt'),
    'x_ebay_payment_methode': fields.selection(
            (('ueberweisung','Überweisung'),
            ('paypal','PayPal'),
            ('bar','Barzahlung'),
            ('sonstige','sonstige'),
            ),'Zahlungsart'),
    'x_ebay_payment_date': fields.date('Zahlungsdatum'),
    'x_ebay_feedback_check': fields.boolean('ebay-Bewertung abgegeben'),
    'x_ebay_link': fields.text('ebay-Auktions-Link', readonly=False, ondelete="set null", select=1),
    'x_ebay_shipped_in_date': fields.date('Wareneingangsdatum'),
    'x_ebay_packer_id': fields.char('Verpackt durch', size=3, readonly=False, ondelete="set null", select=1),
    'x_ebay_storage_id': fields.char('Lagerort', size=6, readonly=False, ondelete="set null", select=1),
    'x_ebay_palett_id': fields.char('Verpackt in Palette', size=3, readonly=False, ondelete="set null", select=False),
    'x_ebay_shipped_out_date': fields.date('Versanddatum'),
    'x_ebay_shipped_out_customs_id': fields.char('Zollnummer', size=10, readonly=False, ondelete="set null", select=1),
    'x_ebay_logistics_company': fields.char('Versandunternehmen', size=10, readonly=False, ondelete="set null", select=False),
    'x_ebay_logistics_company_id': fields.char('Versandauftragsnummer', size=10, readonly=False, ondelete="set null", select=False),
    'x_ebay_comment': fields.text('Kommentar', readonly=False, ondelete="set null", select=False),
    'x_ebay_packer_comment': fields.text('Lager-Kommentar', readonly=False, ondelete="set null", select=False),
    }   
ebay_project()  

ebay_project.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <record model="ir.ui.view" id="purchase_ebay_project_form" >
        <field name="name">purchase_ebay_purchase.order.form</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="arch" type="xml">     
        <xpath expr="//field[@name='partner_ref']" position="after">
                <field name="x_ebay_id"/> 
                <field name="x_ebay_title"/>
            </xpath>
        <xpath expr="//field[@name='date_order']" position="after">
                <field name="x_ebay_date"/>
                <field name="x_ebay_sum"/>
            </xpath>                    
        </field>
    </record>


    <record model="ir.ui.view" id="purchase_ebay_project_form2" >
        <field name="name">purchase_ebay_purchase.order.form2</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="//page[@string='Incoming Shipments &amp; Invoices']" position="after">
                <page string="ebay-Details">
        <group>         
        <group>
                    <field name="x_ebay_seller_username"/>
                    <field name="x_ebay_seller_realname"/>
                    <field name="x_ebay_seller_email"/>
                    <field name="x_ebay_feedback_check"/>
                    <field name="x_ebay_link"/>
                    <field name="x_ebay_comment"/>
        </group>
        <group>
                    <field name="x_ebay_purchaser"/>
                    <field name="x_ebay_payment_check"/>
                    <field name="x_ebay_payment_methode"/>
                    <field name="x_ebay_seller_realname"/>
                    <field name="x_ebay_payment_date"/>
                    </group>
                    </group>
                </page>
            </xpath>
        </field>
    </record>



    <record model="ir.ui.view" id="purchase_ebay_project_form3" >
        <field name="name">purchase_ebay_purchase.order.form3</field>
        <field name="model">purchase.order</field>
        <field name="inherit_id" ref="purchase.purchase_order_form"/>
        <field name="arch" type="xml">
            <xpath expr="//page[@string='Incoming Shipments &amp; Invoices']" position="after">
                <page string="Logistik">
        <group>         
        <group>
                    <field name="x_ebay_shipped_in_date"/> 
                    <field name="x_ebay_packer_id"/>
                    <field name="x_ebay_storage_id"/>
                    <field name="x_ebay_packer_comment"/>
        </group>
        <group>
                    <field name="x_ebay_palett_id"/>
                    <field name="x_ebay_shipped_out_date"/>
                    <field name="x_ebay_logistics_company"/>
                    <field name="x_ebay_logistics_company_id"/>
                    <field name="x_ebay_shipped_out_customs_id"/>
                    </group>
                    </group>
                </page>
            </xpath>
        </field>
    </record>
</data>
</openerp>

0 个答案:

没有答案