Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

The purpose of the implementation is to create a module that contains a model (purchase.order.line) with a custom field (x_quotation_number):

Module structure:

__manifest__.py 

__init__.py

models 

     __init__.py

    purchase_order_line_inherit.py

---------------------------------------

Content of each file:


__manifest__.py:
# -*- coding: utf-8 -*-


‘name’: ‘Quotation Number Implementation’,

 ‘version’: ‘1.0’,

 ‘category’: ‘Sales/Purchases’, 

‘summary’: “Implementation of ‘Quotation Number’ field.”,

 ‘description’: “”" Implementation of ‘Quotation Number’ field in module ‘purchase.order.line’; “”", ‘depends’: [‘base’, ‘purchase’], 

‘installable’: True

}


__init__.py:
# -*- coding: utf-8 -*-

from . import models


models/init.py:
from . import purchase_order_line_inherit


models/purchase_order_line_inherit.py: 
from odoo import fields, models

class PurchaseOrderLineInherit(models.Model):
    _inherit = ‘purchase.order.line’ 
    quotation_number = fields.Char(string=“Quotation Number”)


--------------------------------------- 

Upon importing, it is verified in the fields of the ‘purchase.order.line’ model that the custom field was not added.


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,
Using this way, you can import python files or you can add new fields like this. If you check the import module wizard, there is a warning, stating that, using this, you can only import modules with data files, which means python files are not allowed.

To add new fields, you can use odoo studio.

Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 15
6969
4
paź 25
16182
2
wrz 25
3378
2
lut 22
3506
0
mar 16
3954