-
giuseppeflammia
-
-
Offline
-
Expert Boarder
-
- Messaggi: 100
- Ringraziamenti ricevuti 1
-
Karma: 0
-
|
Ciao a tutti,
sto provando a fare una scrittura a db tramite xml-rpc del seguente oggetto
partnerIdBridge = self._get_partner_fromDB(cr, uid,src_order, context=context)
tgt_order = {
'client_order_ref' : src_order.name+"_"+CURRENT_YEAR+"_"+partner['name'],
'partner_id' : partnerIdBridge['idOdooPartnerDb2'],
'partner_invoice_id' : partnerIdBridge['idOdooPartnerDb2'],
'partner_shipping_id' : partnerIdBridge['idOdooPartnerDb2'],
'pricelist_id' : price_list['id'],
'state' : src_order.state,
'warehouse_id' : ware_list['id'],
'wk_shop' : wk_list['id'],
}
tgt_order_id = conn_res2['sock'].execute(conn_res2['database'], uid, conn_res2['password'], "sale.order", "create", tgt_order)
nel momento in cui provo a inserire i valori "warehouse_id" e "wk_shop" ho un errore del tipo : ERROR bayou_dup openerp.sql_db: bad query: INSERT INTO "sale_order" ("id", "payment_term", "picking_policy", "order_policy", "campaign_id", "create_ddt", "partner_shipping_id", "client_order_ref", "date_order", "partner_id", "user_id", "company_id", "note", "state", "wk_shop", "pricelist_id", "channel", "transportation_method_id", "section_id", "warehouse_id", "partner_invoice_id", "transportation_reason_id", "name", "medium_id", "access_token", "carriage_condition_id", "shipped", "source_id", "goods_description_id", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('sale_order_id_seq'), 1, 'direct', 'manual', NULL, false, 50, 'OV015_2017_Dot', '2017-02-16 17:42:30', 50, 1, 1, NULL, 'manual', 1, 1, 'odoo', NULL, NULL, NULL, 50, NULL, 'OV015', NULL, '90c29889-0a1f-44b0-99f1-574a15de5e66', NULL, false, NULL, NULL, 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
Traceback (most recent call last):
File "/opt/odoo/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
IntegrityError: null value in column "warehouse_id" violates not-null constraint
dal log si intuiesce che il problema sta in "warehouse_id" .
Nei vari tentativi ho provati a scrivere lo stesso oggetto senza warehouse_id e wkshop: esito, sono riuscito a fare la scrittura.
Ora mi chiedo perchè se inserisco anche gli altri due campi mi dice che gli passo un valore null?
Per completezza allego anche un pezzo della ddl della tabella:
CREATE TABLE sale_order
(
id serial NOT NULL,
origin character varying, -- Source Document
create_date timestamp without time zone, -- Creation Date
write_uid integer, -- Last Updated by
client_order_ref character varying, -- Reference/Description
date_order timestamp without time zone NOT NULL, -- Date
partner_id integer NOT NULL, -- Customer
amount_tax numeric, -- Taxes
procurement_group_id integer, -- Procurement group
fiscal_position integer, -- Fiscal Position
amount_untaxed numeric, -- Untaxed Amount
payment_term integer, -- Payment Term
message_last_post timestamp without time zone, -- Last Message Date
company_id integer, -- Company
note text, -- Terms and conditions
state character varying, -- Status
pricelist_id integer NOT NULL, -- Pricelist
create_uid integer, -- Created by
section_id integer, -- Sales Team
write_date timestamp without time zone, -- Last Updated on
partner_invoice_id integer NOT NULL, -- Invoice Address
user_id integer, -- Salesperson
date_confirm date, -- Confirmation Date
amount_total numeric, -- Total
project_id integer, -- Contract / Analytic
name character varying NOT NULL, -- Order Reference
partner_shipping_id integer NOT NULL, -- Delivery Address
order_policy character varying NOT NULL, -- Create Invoice
picking_policy character varying NOT NULL, -- Shipping Policy
incoterm integer, -- Incoterm
warehouse_id integer NOT NULL, -- Warehouse
shipped boolean, -- Delivered
campaign_id integer, -- Campaign
medium_id integer, -- Channel
source_id integer, -- Source
carrier_id integer, -- Delivery Method
channel character varying, -- Channel name
create_ddt boolean, -- Automatically create the DDT
transportation_method_id integer, -- Method of Transportation
transportation_reason_id integer, -- Reason for Transportation
carriage_condition_id integer, -- Carriage Condition
parcels integer, -- Parcels
goods_description_id integer, -- Description of Goods
validity_date date, -- Expiry Date
website_description text, -- Description
access_token character varying NOT NULL, -- Security Token
template_id integer, -- Quote Template
wk_shop integer, -- Magento Store
CONSTRAINT sale_order_pkey PRIMARY KEY (id),
CONSTRAINT sale_order_campaign_id_fkey FOREIGN KEY (campaign_id)
REFERENCES crm_tracking_campaign (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_carriage_condition_id_fkey FOREIGN KEY (carriage_condition_id)
REFERENCES stock_picking_carriage_condition (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_carrier_id_fkey FOREIGN KEY (carrier_id)
REFERENCES delivery_carrier (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_company_id_fkey FOREIGN KEY (company_id)
REFERENCES res_company (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_create_uid_fkey FOREIGN KEY (create_uid)
REFERENCES res_users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_fiscal_position_fkey FOREIGN KEY (fiscal_position)
REFERENCES account_fiscal_position (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_goods_description_id_fkey FOREIGN KEY (goods_description_id)
REFERENCES stock_picking_goods_description (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_incoterm_fkey FOREIGN KEY (incoterm)
REFERENCES stock_incoterms (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_medium_id_fkey FOREIGN KEY (medium_id)
REFERENCES crm_tracking_medium (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_partner_id_fkey FOREIGN KEY (partner_id)
REFERENCES res_partner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_partner_invoice_id_fkey FOREIGN KEY (partner_invoice_id)
REFERENCES res_partner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_partner_shipping_id_fkey FOREIGN KEY (partner_shipping_id)
REFERENCES res_partner (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_payment_term_fkey FOREIGN KEY (payment_term)
REFERENCES account_payment_term (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_pricelist_id_fkey FOREIGN KEY (pricelist_id)
REFERENCES product_pricelist (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_procurement_group_id_fkey FOREIGN KEY (procurement_group_id)
REFERENCES procurement_group (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_project_id_fkey FOREIGN KEY (project_id)
REFERENCES account_analytic_account (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_section_id_fkey FOREIGN KEY (section_id)
REFERENCES crm_case_section (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_source_id_fkey FOREIGN KEY (source_id)
REFERENCES crm_tracking_source (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_template_id_fkey FOREIGN KEY (template_id)
REFERENCES sale_quote_template (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_transportation_method_id_fkey FOREIGN KEY (transportation_method_id)
REFERENCES stock_picking_transportation_method (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_transportation_reason_id_fkey FOREIGN KEY (transportation_reason_id)
REFERENCES stock_picking_transportation_reason (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_user_id_fkey FOREIGN KEY (user_id)
REFERENCES res_users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_warehouse_id_fkey FOREIGN KEY (warehouse_id)
REFERENCES stock_warehouse (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_wk_shop_fkey FOREIGN KEY ( )
REFERENCES magento_store_view (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_write_uid_fkey FOREIGN KEY (write_uid)
REFERENCES res_users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE SET NULL,
CONSTRAINT sale_order_name_uniq UNIQUE (name, company_id)
)
WITH (
OIDS=FALSE
);
Possibili suggerimenti ?
|