class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def action_invoice_open(self):
invoice_obj_wish=self.env['wishlist.invoice.line']
invoice_order_id = self.env['sale.order'].search([('name', '=', self.name)], limit=1).id
for order_details_id in self.browse(invoice_order_id):
vals ={
'invoice_status':'open',
'wishlist_invoice_id': invoice_order_id,
'wish_inv_number':self.number,
'invoice_date':self.date_invoice
}
# invoice_obj_wish.write(vals) @@@@@@@NOT WORKING
return super(AccountInvoice,self).action_invoice_open()class WishlistInvoiceOderLine(models.Model):
_name='wishlist.invoice.line'
invoice_id=fields.Many2one('account.invoice','Invoice Reference')
wishlist_invoice_id = fields.Many2one('sale.order')
partner_id = fields.Many2one('res.partner', 'Customer')
invoice_date = fields.Datetime('Invoice Date')
wishinv_number = fields.Char('Number')
sales_person_id = fields.Many2one('res.partner', 'Sales Person')
wish_due_date=fields.Datetime('Due Date')
wish_source = fields.Char('Source Document')
commit_date=fields.Datetime('Coomittment Date')
total=fields.Float('Total')
wish_amount_due = fields.Float('Amount Due')
invoice_status=fields.Char('Status')
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hello,
write method is not working because "invoice_obj_wish=self.env['wishlist.invoice.line']" it is just an object. in to this you will not able to write. for that you need to browse record set into this object than you can perform operation over it.
invoice_obj_wish=self.env['wishlist.invoice.line'].browse("YOUR_ID_WHICH_IS_CREATED_FROM_OTHER_METHOD")
than use "invoice_obj_wish.write(vals)" to update values in your existing record.
Thanks & Regards,
Siddharth Gajjar
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อ
Once try with,
invoice_id = invoice_obj_wish.create(vals)
invoice_obj = invoice_obj_wish.browse(invoice_id)
invoice_obj.write(vals)
For that only i have provided syntax above,
invoice_obj_wish.write(vals) ## Its not correct write statement,you need to have object where you can write.