تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
2407 أدوات العرض

i am using odoo 14 and trying to create a server action button in product list view. 


"""

record is defined in comment section

"""


server action defines here 


class Products(models.Model):
_inherit = "product.template"

def batch_publish(self):
for prod in self :
if prod.can_publish and prod.is_published != True :
prod.is_published = True


But i got error upgrading the module.

الصورة الرمزية
إهمال
الكاتب

<record id="batch_publish_products" model="ir.actions.server">

<field name="name">Published</field>

<field name="model_id" ref="product.template"/>

<field name="binding_view_id" ref="product.template"/>

<field name="binding_view_types">list</field>

<field name="state">code</field>

<field name="code">action = records.batch_publish()</field>

</record>

أفضل إجابة
try this
الصورة الرمزية
إهمال

<record id="batch_publish_products" model="ir.actions.server">

<field name="name">Published</field>

<field name="model_id" ref="your_module_name.product_template"/>

<field name="binding_model_id" ref="your_module_name.product_template"/>

<field name="state">code</field>

<field name="code">action = records.batch_publish()</field>

</record>

المنشورات ذات الصلة الردود أدوات العرض النشاط
3
سبتمبر 25
2658
0
أغسطس 25
212
1
أغسطس 25
2190
2
يوليو 25
8078
2
يوليو 25
4540