Reputation: 1
I was inherited some fields in product.category model and i want to show that some other fields on my other companies.. I am tried to give the answer on create function and Also tried on other Button But i can't write the values that i give in the main company to other companies.. Please Help me to find the Answer..
@api.model def create(self, vals_list): res = super(ProductCentralized, self).create(vals_list) vals = []
vals.append({
'property_cost_method': res.property_cost_method,
'name':res.name,
'property_valuation': res.property_valuation,
'property_stock_valuation_account_id': res.property_stock_valuation_account_id,
'property_stock_journal': res.property_stock_journal,
'property_stock_account_input_categ_id': res.property_stock_account_input_categ_id,
'property_stock_account_output_categ_id': res.property_stock_account_output_categ_id,
})
res.sudo().create({'property_cost_method': self.property_cost_method,
'name': self.name,
'property_valuation': self.property_valuation,
'property_stock_valuation_account_id': self.property_stock_valuation_account_id,
'property_stock_journal': self.property_stock_journal,
'property_stock_account_input_categ_id': self.property_stock_account_input_categ_id,
'property_stock_account_output_categ_id': self.property_stock_account_output_categ_id})
return res
Please Help me to correct this code or using another button.. Thanks in Advance..
Upvotes: 0
Views: 84
Reputation: 1314
Consider changing the corresponding view : "res.partner.form" instead. You can find it this way : in App Settings, switch to debug mode by adding "?debug=1" in your url, reload the page, then go to the new Technical Menu-tab > View.
Then you can display your partner/company(id= 1344 ) fields, using :
For Back-Office :
<t t-esc="self.env['res.partner'].browse(1344).name" />
For Front-Office :
<t t-esc="request.env['res.partner'].browse(1344).name" />
Or you can display your product_template (id= 135 ) fields, using :
<t t-esc="self.env['product.template'].browse(135).property_valuation" />
Or you can display your stock fields, using :
<t t-esc="self.env['stock.quant'].search([('product_id','=','5')]).location_id.name" />
Upvotes: 0