【发布时间】:2023-04-04 23:59:01
【问题描述】:
<record id="product.product_normal_action_sell" model="ir.actions.act_window">
<field name="name">Product Variants</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">kanban,tree,form,activity</field>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="domain">[('user', '=', "Ignored value")]</field>
<field name="view_id" ref="product.product_product_tree_view"/>
<field name="search_view_id" ref="product.product_search_form_view"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new product variant
</p><p>
You must define a product for everything you sell, whether it's a physical product,
a consumable or a service you offer to customers.
The product form contains information to simplify the sale process:
price, notes in the quotation, accounting data, procurement methods, etc.
</p>
</field>
</record>
我想在登录时始终更改用户字段。 我知道我可以使用默认但默认功能不会影响现有产品。我想为此用户相关字段。请建议我。
_inherit = 'product.template'
_description = "Product filter"
category_branch = fields.Many2one('multi.branch', string="Branch Name",related="categ_id.branch_id",rea
class ResUsers(models.Model):
"""Res Users Model."""
_inherit = 'res.users'
@api.model
def _get_branch(self):
return self.env.user.branch_id
branch_id = fields.Many2one('multi.branch', string='Branch',
default=_get_branch,
help='The branch this user is currently \
working for.')
只有=真)
【问题讨论】: