0

開発者の仕事の申し出モジュールに行きます。そのモジュールで、関連する部門を選択した場合、(プランテーション業界で)彼らの仕事の申し出のために労働者を選択できます。ランチモジュール(ランチオーダーフォーム)を比較してみましたが、このエラーが発生しました。(OpenERP ver 7)

これが私のview.xmlです

    <record model="ir.ui.view" id="bpl_work_offer_form">
        <field name="name">bpl.work.offer.form</field>
        <field name="model">bpl.work.offer</field>
        <field name="arch" type="xml">
            <form string='bpl_work_offer'>
                <sheet>
                    <group>
                        <group>
                            <field name='user_id' />
                        </group>
                        <group>
                            <field name='date_of_offer' />
                        </group>
                    </group>
                    <div name="Worker Selection"></div>
                    <separator string='Select workers' />
                    <field name='selected_workers_line_ids' nolabel='1'>
                        <tree string='List' editable='bottom'>
                            <field name='worker_id' />
                            <field name='is_selected' />
                        </tree>
                    </field>
                    <group class='oe_subtotal_footer oe_right'>
                        <field name='total_workers' />
                    </group>
                    <br />
                    <br />
                </sheet>
            </form>
        </field>
    </record>

これが私のモデルクラスです

class bpl_work_offer(osv.osv):
    _name = "bpl.work.offer"
    _description = "BPL Work Offer"
    _columns = {
        'user_id': fields.many2one('res.users', 'User Name'),
        'date_of_offer': fields.date('Date'),
        'bpl_company_id':fields.many2one('bpl.company.registration', 'Company', help='Company'),
        'bpl_estate_id':fields.many2one('bpl.estate.registration', 'Estate', help='Estate'),
        'bpl_division_id':fields.many2one('bpl.division.registration', 'Division', help='Division'),
        'payment_type': fields.selection([('normal_work', 'Normal Work'), ('cash_work', 'Cash Work'), ('contract_work', 'Contract Work')], 'Payment Type'),
        'select_by': fields.selection([('by_name', 'By Names'), ('by_count', 'By Count')], 'Select  By'),
        'work_type': fields.selection([('tea', 'Tea'), ('rubber', 'Rubber'), ('sundry', 'Sundry')], 'Work Type'),
        'total_workers': fields.integer('Total Workers'),
        'selected_workers_line_ids': fields.one2many('selected.workers.line', 'worker_id', 'Workers', ondelete="cascade"),
    }

bpl_work_offer()

class selected_workers_line_ids(osv.osv):
    _name = 'selected.workers.line'
    _description = 'lunch order line'
    _columns = {
        'worker_id':fields.many2one('bpl.worker', 'Worker', help='Worker'),
        'is_selected': fields.boolean('Select', help="Selected or not"),
        }

selected_workers_line_ids()

私のエラーはこのようなものです

2013-03-21 06:31:50,137 7539 ERROR bpl openerp.addons.base.ir.ir_ui_view: <string>:2:0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element form has extra content: sheet
2013-03-21 06:31:50,164 7539 ERROR bpl openerp.tools.convert: Parse error in /home/priyan/Software/openerp-7.0-20130309-002120/openerp/addons/bpl/bpl_view.xml:276: 
<record model="ir.ui.view" id="bpl_work_offer_form">
            <field name="name">bpl.work.offer.form</field>
            <field name="model">bpl.work.offer</field>
            <field name="arch" type="xml">
                <form string="bpl_work_offer">
........
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/osv/orm.py", line 1544, in _validate
    raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')
2013-03-21 06:31:50,185 7539 INFO bpl werkzeug: 127.0.0.1 - - [21/Mar/2013 06:31:50] "POST /web/session/authenticate HTTP/1.1" 200 -

保存しようとするとエラーが発生します。テーブルとのマッピングの問題がどこにあるかを確認してください

Traceback (most recent call last):
  File "/home/priyan/Software/openerp-7.0-20130309-002120/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
IntegrityError: insert or update on table "selected_workers_line" violates foreign key constraint "selected_workers_line_worker_id_fkey"
DETAIL:  Key (worker_id)=(1) is not present in table "bpl_worker".

2013-03-21 07:17:25,125 8275 ERROR bpl openerp.netsvc: Integrity Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set
4

1 に答える 1

5

あなたはこのように正しくする必要があります:

<form string='bpl_work_offer' version="7.0">

その後、それは動作します

于 2013-03-21T07:00:49.950 に答える