-1

I have error in my inheritance in odoo

odoo.tools.convert.ParseError: "Error while validating constraint Field production_date does not exist

I have attached both XML code and python file

I have tried changing file name and saving model in separate file too

XML File

<odoo>
  <data>
    <record id="stock_form_inherite_view" model="ir.ui.view">
      <field name="name">stock.date.inherit.view</field>
      <field name="model">stock.picking</field>
      <field name="inherit_id" ref="stock.view_picking_form" />
      <field name="arch" type="xml">
        <xpath expr="//field[@name='move_line_ids']/tree/field[@name='product_id']" position="after">
          <field name='production_date' readonly="1"/>
          <field name='expiry_date' readonly="1"/>
        </xpath>
      </field>
    </record>
  </data>
</odoo>

Python File

from odoo import models, fields

class StockPicking(models.Model):
"""Added the new field quantity which is related field to   stock_move."""
_inherit = 'stock.picking'

product_qty = fields.Float(string="Quantity", related="move_lines.product_uom_qty")



class stockpickingline(models.Model):
"""Added For the Production Date and Expiry Date"""
_inherit='account.invoice.line'
lot_number = fields.Many2one('stock.production.lot', string='Lot Number')
production_date = fields.Date('Production date',  related='lot_number.production_date')
expiry_date = fields.Datetime('Expiry date', related='lot_number.life_date')
barbsan
  • 3,418
  • 11
  • 21
  • 28
Abdullah
  • 1
  • 2
  • odoo.tools.convert.ParseError: "Error while validating constraint Field `production_date` does not exist – Abdullah Jul 02 '19 at 10:24

1 Answers1

0

You are adding production_date field in account.invoice.line in py and calling it inside move_line_ids in stock_picking. Usually move_line_ids in stock.picking is related to stock_move model. please check move_line_ids relation.

Thayif kabir
  • 715
  • 5
  • 20