Hey guys, I created a form to receive data for a store. But on clicking the "save" button, i get this error: except_osv: ('Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: Product Unit of Measure - product.uom]')
I really don't know why this error since i didn't inherit any object except the "mail.thread" object. Please i need help concerning this. It has really taken my time and i have limited time to deliver. And I don't know where else to look to solve it.
Any help will be appreciated please.
class store_products(osv.osv):
    _name='store.products'
    _description='Store Products'
    _inherit=['mail.thread']
    _columns={
         'name': fields.char('Description', size=128, required=True, translate=True, select=True),
         'my_product_id': fields.many2one('product.product', 'Product', required=True, select=True),
         'product_qty': fields.integer('Quantity', required=True, track_visibility='onchange'),
         'store_product_id': fields.many2one('store.issuing.voucher', 'Products'),
         'value': fields.float('Value (NGN)', size=32,track_visibility='onchange'),
         #'account_code': fields.char('Account Code', size=32, readonly=False, required=True, track_visibility='onchange'),
         'account_code': fields.many2one('account.account', 'Account Code', required=True, track_visibility='onchange',
                                          help="The partner account used for this invoice."),
           }
store_products()
class store_issuing_voucher(osv.osv):
    _name = "store.issuing.voucher"
    _inherit = [ 'mail.thread']
    _description = "The Store Issuing Voucher"
    _columns={
          'employee_id': fields.many2one('hr.employee', 'Requestor', required=False,track_visibility='onchange'),
          'department_id': fields.many2one('hr.department', 'Department', required=False, track_visibility='onchange'),
          'organizational_id': fields.many2one('store.voucher.organization', 'Organizational Code', required=False, track_visibility='onchange'),
          'fund_code': fields.char('Fund Code', size=32, readonly=False, required=False, track_visibility='onchange'),
          'program_code': fields.char('Program Code', size=32, readonly=False, required=False, track_visibility='onchange'),
          'location_code': fields.char('Location Code', size=32, readonly=False, track_visibility='onchange'),
          'manager_id': fields.many2one('hr.employee', 'Store Voucher Present Manager', required=False, track_visibility='onchange'),              
          'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}),
          'date': fields.datetime('Date', require=True, select=True),
          'mystore_product_ids': fields.one2many('store.products', 'store_product_id', 'Store Product Lines'),
          'value': fields.float('Value (NGN)', size=32,track_visibility='onchange'),
          'note': fields.text('Notes'),
}
store_issuing_voucher()
XML :
<record id="store_issuing_voucher_form" model="ir.ui.view">
        <field name="name">store.issuing.voucher.form</field>
        <field name="model">store.issuing.voucher</field>
        <field name="arch" type="xml">
            <form string="Store Issuing Voucher" version="7.0">
                    <sheet string="Store Issuing Voucher">
                        <group string="Requestor Details" col="4">
                            <field name="employee_id" on_change="onchange_employee_id(employee_id,department_id)" />
                            <field name="department_id"/>
                            <field name="date" />
                            <field name="organizational_id"  />
                            <field name="fund_code"  />
                            <field name="program_code"  />
                            <field name="location_code"  />
                            <field name="manager_id" />                                 
                        </group>
                    <group string="Product Item Details">
                        <notebook>
                            <page string="Store Products Lines">
                                <field name= "mystore_product_ids" />
                                <field name="note" placeholder="Add any note..." class="oe_inline" />
                            </page>
                        </notebook> 
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
        </field>
    </record>
    <!-- End of Store Issuing Voucher Form View -->
     <!-- Store Issuing Voucher tree View -->
    <record id="store_issuing_voucher_tree" model="ir.ui.view">
        <field name="name">store.issuing.voucher.tree</field>
        <field name="model">store.issuing.voucher</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree string="Vouchers" >
              <!--  <field name="my_product_id"/>  -->
                <field name="employee_id"/>
                <field name="department_id" />
                <field name="organizational_id"/>
                <field name="program_code"/>
                <field name="value"/>
                <field name="date"/>
            </tree>
        </field>
    </record>
 <record id="store_products_form" model="ir.ui.view">
        <field name="name">store.products.form</field>
        <field name="model">store.products</field>
        <field name="arch" type="xml">
            <form string="Store Product Lines" version="7.0">
                <sheet>
                    <group col="4">
                        <field name="account_code"/>
                      <field name="my_product_id" on_change="onchange_my_product_id(my_product_id)"/>  
                      <!-- <field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
                        <field name="name"/>-->
                        <field name="product_qty"/>
                        <field name="value"/>
                    </group>
                </sheet>
                <div class="oe_chatter">
                    <field name="message_follower_ids" widget="mail_followers"/>
                    <field name="message_ids" widget="mail_thread"/>
                </div>
            </form>
 <record id="store_products_tree" model="ir.ui.view">
        <field name="name">store.products.tree</field>
        <field name="model">store.products</field>
        <field name="arch" type="xml">
            <tree string="Store Products">
                <field name="account_code"/>
                <field name="my_product_id"/>
                <field name="product_qty"/> 
                <field name="value"/>
            </tree>
        </field>
   </record>
 
                        
paste your code over here.
Canyou post your XML as well in the original question?
I have posted both py and xml files. thanks