Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6264 Lượt xem

Hello Odoo community,

I created a wizard which has 2 fields start date and end date, with in the wizard user can choose the date and im trying to use that date value to filter invoice report but for some reason i cant retrieve my start date from the wizard it comes as empty all the time. Any suggestion or any ideas what im doing wrong

Code example

from openerp import fields,api
from openerp.osv import orm


class post_invoice_wizard(orm.TransientModel):
_name = 'post.invoice.wizard'
start_date = fields.Date('Start Date')
   end_date = fields.Date('End Date')

@api.model
def _post_invoice_ids(self):
for rec in self:
           post_invoice_ids=self.env['posted.invoice.report'].search([('date_invoice', '>=', rec.start_date)])
return post_invoice_ids
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Darius,

I have doubt in @api.model which you have used for your method and I guess you should use @api.multi instead.

Documentation:

1: Decorators

2: API Guideline 

Hope this will help you.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 22
3324
2
thg 11 23
3190
7
thg 4 21
20581
1
thg 10 20
4949
2
thg 11 16
4291