Hello,
I added 1 button in Purchase order that is work for Receive Product and Create Bill at once.
Code :-
@api.multi
def receive_with_bill(self):
new_invoice = self.action_view_invoice()
picking_ids = self.env['stock.picking'].search([('origin', '=', self.name)])
for picking in picking_ids:
picking.action_confirm()
picking.button_validate()
self.env['stock.immediate.transfer'].create({'pick_ids': [(4, picking.id)]}).process()
Here Stock Picking is validated and stock is updated, but Bill isn't create.
I added print statement in action_view_invoice() which is in the purchase.py under puchase module. This method is also called but Bill isn't create.
How to solve this issue in odoo12.0 ?
Any answer will be appreciable.
Thanks,
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
You need to write code for create invoice in your function. action_view_invoice is not a method to create invoice. Below is the code to create invoice after receive product. You need to pass PO id in invoice during creation-
po_invoice = {
'partner_id': self.partner_id.id,
'account_id': self.partner_id.property_account_payable_id.id,
'state': 'draft',
'type': 'in_invoice',
'date_invoice': self.date_order,
'purchase_id': self.id,
}
inv = self.env['account.invoice'].create(po_invoice)
inv.purchase_order_change()
inv.action_invoice_open()
One more suggestion rathen than doing picking search with origin, You can find picking_ids field in PO which show all incoming shipment related to PO.
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
6
مايو 20
|
4640 | ||
|
0
مارس 15
|
4251 | ||
|
3
يوليو 25
|
2008 | ||
|
1
يونيو 22
|
3165 | ||
|
2
نوفمبر 21
|
2676 |