4476mountvernon.com is the world"s easiest all-in-one management software. It includes hundreds of business apps:

CRM e-Commerce Accounting Inventory PoS Project management MRP Take the tour
*

My custom model try to send data to account.invoice and account invoice lines.But I got Error

ValueError: dictionary update sequence element #0 has length 3; 2 is required

Here is my code,

result = super(create_invoice_wizard,self).default_get(fields)

res = <>

invoice_line_ids = <>

flag = True

for obj_ppo_id in obj_ppo_ids:

invoice_data = self.env<"sale.commission">.search(<("id","=",obj_ppo_id.id)>)

if flag:

res.append({

"partner_id":invoice_data.consignor.id,

"date_invoice":datetime.today(),

"invoice_line_ids": <{

"product_id":invoice_data.product_id.id,

"quantity":invoice_data.qty,

"price_unit":invoice_data.total_sales}>

})

flag = False

else:

res<0><"invoice_line_ids">.append({"product_id":invoice_data.product_id.id,

"quantity":invoice_data.qty,

"price_unit":invoice_data.total_sales})

result.update(res)

return result

 


Comment Share
*

Post Comment Discard
1 Answer
0
*

Samo Arko
*

--Samo Arko--
2256

| 6 4 8
Pragersko, Slovenia
--Samo Arko--
">
*

Samo Arko
16 July 2018
Best Answer

you need to use special functions to pass data to related fields. it should be

"invoice_line_ids": <(0, 0, {your dict with data})>this looks like only just one argument, but the reference (self) is the first argument. 

 


Comment Share
*

Post Comment Discard
Community
Open Source
Services
About us
*
English
*
الْعَرَبيّة
*
简体中文
*
繁體中文
*
Nederlands
*
English
*
Français
*
Deutsch
*
Bahasa Indonesia
*
Italiano
*
日本語
*
한국어 (KR)
*
Português (BR)
*
русский язык
*
Slovenský jazyk
*
Español
*
ภาษาไทย
*
Türkçe
*
українська
*
Tiếng Việt

4476mountvernon.com is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

You are watching: Dictionary update sequence element #0 has length 1; 2 is required

4476mountvernon.com"s unique value proposition is to be at the same time very easy to use and fully integrated.


Website made with
Powered by
*
- The #1 Open Source eCommerce

Rental Biz with 4476mountvernon.com on YouTube

1. Use the live chat to ask your questions.

See more: Convert 68 Degrees C To F (68 Celsius To Fahrenheit), 68 Fahrenheit To Celsius (68 F To C) Converted

2. The operator answers within a few minutes.