Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
1245 Переглядів

Hi!

I urgently need your help!

I'm trying to set-up an invoice format with special fields

Here is the additionnal fields that I added 

- Name of the animal 

- date of the service (which is usually different that the invoice date)

(I will need other special functions but that can come later)

I could add both fields but I have an error message

Could somebody help me with the config?


Let me know what you need (template, code), sorry I'm new !

Аватар
Відмінити
Найкраща відповідь

Hi, 


Try this code:

1. Add Fields to the Model:

from odoo import models, fields

class AccountMove(models.Model):
    _inherit = 'account.move'

    animal_name = fields.Char(string='Animal Name')
    service_date = fields.Date(string='Service Date')


2. Update the View:

<record id="view_invoice_form_inherit" model="ir.ui.view">
<field name="name">account.move.form.inherit</field>
<field name="model">account.move</field>
    <field name="inherit_id" ref="account.view_move_form"/>
    <field name="arch" type="xml">
        <data>
<xpath expr="//field[@name='partner_id']" position="after">
                <field name="animal_name"/>
                <field name="service_date"/>
            </xpath>
        </data>
    </field>
</record>

Make sure to adapt the code based on your specific model names and view structures.


Hope it helps

Аватар
Відмінити
Автор Найкраща відповідь

Sorry for my late answer, I've been on sick leave and could not catch-up with the developpment.

It worked fine!

Many thanks for your time :-)

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
3
лип. 25
2462
1
бер. 25
1183
1
лют. 25
1392
1
лют. 25
1259
2
лист. 24
1378