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

I have a form view "stock_production_lot" that allow for creation of a serial number for a given part.  When I goes thru the Master Data->Parts-> (select a part that is serialized); and then open the corresponding lot serial number tree view; and from that view, click Create, it will open up the form view of "stock_production_lot" and the product is displayed as the product from the previous screen.  But when I tried to save the information, it will complain that there is no "product_id".

Just to do some debugging, I put the print statement with the default_get method to print out the self._context and gotten this:

self.context = {'lang': 'en_US', 'tz': 'America/Los_Angeles', 'uid': 874, 'active_model': 'product.template', 'active_id': 42348, 'active_ids': [42348], 'default_product_id': 42154, 'search_disable_custom_filters': True}

Since the product did show up on the screen, it looks like it was able to use the "default_product_id" to set up the field correctly.

However, when I put the debugging print statement at the create to print out the "vals", I don't see product_id at all.

vals = {'dyn_number': '0000HJ', 'vendor_serial': False, 'ref': False, 'use_date': False, 'removal_date': False, 'life_date': False, 'alert_date': False, 'dyn_stop_integration': False, 'dyn_status': 0, 'dyn_update_date': False, 'dyn_request': False, 'dyn_response': False, 'message_attachment_count': 0, 'name': '0000HJ'}

Why is that?  Do I need to "specifically" set the value of product_id! But I thought that was done automatically especially given that the product information actually shows up on the screen/view itself.



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
2713
0
thg 3 24
829
0
thg 9 22
1177
1
thg 7 22
4807
0
thg 6 22
836