Goal
I want to create delivery from a selection of order lines, but I can't get the button to appear.
Module
compose_delivery_order/
├── delivery_order_button.py
├── delivery_order_button.xml
├── images/
│?? └── delivery_order_button.png
├── __init__.py
├── __openerp__.py
├── order_to_invoice_create_delivery_button.py
├── order_to_invoice_create_delivery_button.xml ← I'm working on this
├── sale_order_button.py
└── sale_order_confirm_button.xml
XML <record>
<record id="action_sale_order_liquidar" model="ir.actions.server">
<field name="name">Liquidar</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_sale_order"/>
<field name="state">code</field>
<field name="code">self.some_custom_code(cr, uid, context.get('active_ids'), context=context)</field>
</record><record id="id_of_the_action_value" model="ir.values">
<field name="name">Liquidar</field>
<field name="action_id" ref="action_sale_order_liquidar"/>
<field name="value" eval="'ir.actions.server,' + str(ref('action_sale_order_liquidar'))"/>
<field name="key">action</field>
<field name="model_id" ref="model_sale_order"/>
<field name="model">sale.order</field>
<field name="key2">client_action_multi</field>
</record>
Python
import logging
from openerp import netsvc
from openerp.osv import osv
logger = logging.getLogger(__name__)
class sale_order_line(osv.osv):
_inherit = 'sale.order.line'
def some_custom_code(self, db_cursor, user_id, ids, context=None):
logger.error('+ + + + + + sale_order_line -> some_custom_code + + + + + + ')
return True
def some_custom_code(self, db_cursor, user_id, ids, context=None):
logger.error('+ + + + + + some_custom_code + + + + + + ')
return True
Question
How do I add the button ? Either to submenu of [More v]
or next to [Create] or Import
.
N.B.: I check it's imported in the __openerp__.py
's data
section.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…