Dear all,
I am working on Odoo 12 and having problems on accessing the code that prints the "report delivery slip".
Odoo has 2 basic reports under Stock Picking: Picking Operations (action_report_picking) and Delivery Slip (action_report_delivery)
For the Picking Operations I can see Odoo has a method for printing and also the corresponding action:
@api.multi
def do_print_picking(self):
self.write({'printed': True})
return self.env.ref('stock.action_report_picking').report_action(self)
<report
string="Picking Operations"
id="action_report_picking"
model="stock.picking"
report_type="qweb-pdf"
name="stock.report_picking"
file="stock.report_picking_operations"
print_report_name="'Picking Operations - %s - %s' % (object.partner_id.name or '', object.name)"
/>
For the Delivery Slip, I only see an action and cannot find the method that calls it:
<report
string="Delivery Slip"
id="action_report_delivery"
model="stock.picking"
report_type="qweb-pdf"
name="stock.report_deliveryslip"
file="stock.report_deliveryslip"
print_report_name="'Delivery Slip - %s - %s' % (object.partner_id.name or '', object.name)"
/>
When I access Inventory | Deliveries, I can see 2 buttons depending on the document state:
- When in draft or assigned, I can see a Print button that calls the "do_print_picking" method and this is ok. This will call the action_report_picking action;
- When the stock operation is on "done" state, I can see another Print button with an ID instead of a method. In this case, the ID=154. This button is printing the action_report_delivery which I need to access;
This ID = 154 method has the following code under the xml:
<button name="154" string="Print" attrs="{'invisible': ['|', ('state', '!=', 'done'), ('is_locked', '=', False)]}" type="action" groups="base.group_user"/>
What I need to do is to execute a code when this "action_report_delivery" is executed and I do not know how to do it because I cannot access the action ID.
I cannot find any code under StockPicking py file that calls this action.
Can anyone help me please?
Thank you all in advance
Best regards
PM