one2many

ODOO - How to update two levels o2m fileds relation

你离开我真会死。 提交于 2021-01-29 22:40:31
问题 Odoo community version 11.0-20190311 I have a parent class (dt_tst001) with a o2m field (itens) related to a class (dt_tst002), with another o2m field (tributos) related to a third class (dt_tst003). In the parent class there is another field (seguro_total) and when its value is changed I need to start a recalculation (_upd_seguro) of field (seguro) in the second class and fields (base_calculo, valor_tributo) in the third class. The recalculation in the second class is working, but not in the

Validation on export data for one2many field column in Odoo 13

自闭症网瘾萝莉.ら 提交于 2020-04-15 22:43:57
问题 I want to show validation error when the user export records for state='draft'(in one2many field). I have done code for it and it's working fine. but when I put this code for one2many table then I unable to get a validation message. My code is below: class DailyTransaction(models.Model): _name = 'daily.transaction' _rec_name = 'batch_id' date = fields.Date() batch_id = fields.Char() daily_transaction = fields.One2many('transaction.log', 'daily_trans_log', string='Daily Transaction') class

Validation on export data for one2many field column in Odoo 13

非 Y 不嫁゛ 提交于 2020-04-15 22:41:28
问题 I want to show validation error when the user export records for state='draft'(in one2many field). I have done code for it and it's working fine. but when I put this code for one2many table then I unable to get a validation message. My code is below: class DailyTransaction(models.Model): _name = 'daily.transaction' _rec_name = 'batch_id' date = fields.Date() batch_id = fields.Char() daily_transaction = fields.One2many('transaction.log', 'daily_trans_log', string='Daily Transaction') class

Set default value while creating record from one2many field - odoo

杀马特。学长 韩版系。学妹 提交于 2019-12-19 05:09:31
问题 I want to set default value for multiple fields while creating records from one2many field, in that default value will be taken from the parent model. Odoo Model Structure class purchase_order(models.Model): _inherit='purchase.order' cash_forecast_ids = fields.One2many(comodel_name='cash.forecast', inverse_name='purchase_order_id', string='Payment Schedules') class cash_forecast(models.Model): _name='cash.forecast' purchase_order_id = fields.Many2one(comodel_name='purchase.order', string='PO'

How to bind value from one2many dropdown data to column field in odoo 12?

ε祈祈猫儿з 提交于 2019-12-11 06:35:40
问题 i trying to add field named "price" from one2many dropdown relationship to the parent table, which is i relate the second table with many2one relationship? can i do this? if yes, how to do this? here is my salesorder class code : # -*- coding: utf-8 -*- from odoo import models, fields, api class SalesorderSalesorder(models.Model): _name = 'salesorder.salesorder' no_faktur = fields.Char(String='No Faktur', required=True) kd_dealer = fields.Char(String='Kode Dealer', required=True) nm_dealer =

odoo 9 - how to restrict one2many to not show a form view

为君一笑 提交于 2019-12-11 01:40:53
问题 I have a many2many, which is using the one2many widget. I set mode="tree" and am using editable="bottom". This works as expected in edit mode, however when in view mode - if the user clicks on a line it opens the line in a form view - how do i prevent this? I either want nothing to happen, or to allow user to click on one of the _id items on the line. Either way, clicking on the line should not open the record in a form view. <field name="test_ids" widget="one2many" nolabel="1" mode="tree">

Set default value while creating record from one2many field - odoo

一世执手 提交于 2019-12-01 01:57:43
I want to set default value for multiple fields while creating records from one2many field, in that default value will be taken from the parent model. Odoo Model Structure class purchase_order(models.Model): _inherit='purchase.order' cash_forecast_ids = fields.One2many(comodel_name='cash.forecast', inverse_name='purchase_order_id', string='Payment Schedules') class cash_forecast(models.Model): _name='cash.forecast' purchase_order_id = fields.Many2one(comodel_name='purchase.order', string='PO', select=True, copy=False) foreign_currency_amount = fields.Float("Foreign Currency Amount", copy=False