Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
969 Zobrazení

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\oodo 14\server\odoo\http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "D:\oodo 14\server\odoo\http.py", line 316, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'invoice_seq' on model 'product.product'

my code

from odoo import api, fields, models, _


class SkitVendorInvoice(models.Model):
_name = "skit.vendor.invoice"
_description = "Vendor Invoice"

# vendor_name = fields.Char(string="Name")
vendor_id = fields.Many2one('res.partner', string="Supplier/Vendor", required=True)
help_id = fields.Many2one('product.product', string="product")
invoice_seq = fields.Char(string='Sales Invoice', required=True, copy=False, readonly=True,
default=lambda self: _('New'))
invoice_date = fields.Date(string="Invoice Date")
amount = fields.Integer(string="Amount")
product_sale_ids = fields.One2many('product.vendor.invoice', 'product_id', string='product vendors')

@api.model
def create(self, values):
if values.get('invoice_seq', _('New')) == _('New'):
values['invoice_seq'] = self.env['ir.sequence'].next_by_code('sales.invoice') or _('New')
res = super(SkitVendorInvoice, self).create(values)
return res


class ProductVendorInvoice(models.Model):
_name = "product.vendor.invoice"
_description = "Product Vendor Invoice"

description = fields.Char(string='Description')
qty = fields.Integer(string='Quantity')
# product_id = fields.Many2one('skit.vendor.invoice', string='product')
product_id = fields.Many2one('product.product', string="product")

um_code = fields.Char(string='UoM Code')
unit_price = fields.Integer(string='Unit Price')
sub_total = fields.Integer(string='Sub Total')

Avatar
Zrušit