Skip to Content
Menu
This question has been flagged
2 Replies
8788 Views

"XMLFile"

<form>
                    <sheet>
                        <h1 align="center">Fatora</h1>
                        <group>
                            <field name="name" string="client name"/>
                            <field name="bill_number" string="Number"/>
                            <field name="bill_date" string="Purchase date"/>
                            <field name="Product_id" string="products" widget="many2many_tags"/>
                        </group>
                    </sheet>
                </form>


model market.bills.py

class PurchaseBill(models.Model): 

_name = 

_rec_name = 

bill_number = fields.Integer() 

Product_id = fields.Many2many('market.products')  

bill_date = fields.Datetime() 

client = fields.One2many('market.clients','bills')


model market.clients.py

class MarketClients(models.Model):
    _name = 'market.clients'

    name = fields.Char()
    bills = fields.Many2one('market.bills', string='client bills')

Avatar
Discard

Hope this will helps you: https://youtu.be/tx1ONN2e8hk

Best Answer

Dear Omar Ahmed,


Try to use Context on .XML One2many field like this:


context="{'default_field_o2m':field_of_your_parent_view}"


I hope I helped you..

Avatar
Discard
Best Answer

Hi

can you please refer this answer:

https://www.odoo.com/forum/help-1/question/how-can-i-get-the-parent-value-in-the-creation-of-a-child-in-odoo-9-134451

https://stackoverflow.com/questions/31244937/how-to-get-a-field-of-the-parent-form-from-a-pop-up-in-odoo

Thank you.


Avatar
Discard
Related Posts Replies Views Activity
2
Nov 19
9714
0
Aug 18
1874
1
May 17
6699
2
Dec 23
6171
2
Dec 23
11087