# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from datetime import datetime
class dha(models.Model):
_name = 'vanphongpham.dha'
ds_vpp = fields.One2many(comodel_name="vanphongpham.dha.detail", inverse_name="dsdmvpp", string="Required")
@api.onchange("ds_vpp")
def summoney(self):
for line in self.ds_vpp:
print line.amount
tada = line.dsdmvpp # not show result
for oke in tada:
print oke.gia_ca_vpp
class dhadtl(models.Model):
_name = 'vanphongpham.dha.detail'
#book_load = fields.Many2one("vanphongpham.dha", "Phieu muon", required=True)
dsdmvpp = fields.Many2one("product.product", "List stationery", required=True)
amount = fields.Integer(string='Amount', required=True, default='1')
How to get value sale price from in "summoney"?
Thanks in advance!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
3338
Views
Hi DHA,
I notice that you declared a O2M with comodel_name="vanphongpham.dha.detail" and inverse_name = 'dsdmvpp'. That means in ''vanphongpham.dha.detail'' object, you need to have dsdmvpp=M2O('vanphongpham.dha', ...)
and not to ''product.product''.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Sep 22
|
7896 | ||
|
2
Apr 22
|
2462 | ||
|
0
Jul 21
|
5330 | ||
|
1
Mar 21
|
3344 | ||
|
5
Aug 20
|
16307 |
Relationship of One2Many is not correctly defined, You need to define the Many2one field of the model (Where One2Many is defined) into co-model (In your case co-model is vanphongapham.dha.detail).