Hi,

I don’t understand how to add fields to the SaleLine model. The tests complain 
about the new field not existing.
I tested with Party, everything works as expected. But fields added to SaleLine 
lead to nothing created in db.
I cannot see anything in the logs. 
Please point my error…

Here is the small test I made :

1. First minimal module :

# trytond/trytond/modules/symetrie/__init__.py
from trytond.pool import Pool
from party import *

def register():
    Pool.register(
        Party,
        module='symetrie', type_='model')

# trytond/trytond/modules/symetrie/party.py

from trytond.model import fields
from trytond.pool import PoolMeta

__all__ = ['Party']

class Party:
    __metaclass__ = PoolMeta
    __name__ = 'party.party'

    game_score = fields.Numeric('Game Score', digits=(10, 4))
    game_name = fields.Char('Game Name', 100)

# end

I create a new db:
        createdb t44_2
        cd tryton4.4
        trytond/bin/trytond-admin -v -p -c my_local_trytond.conf -d t44_2 --all

I activate the modules
        'account_fr', 'account_invoice', 'account_invoice_history', 
'account_statement', 'account_stock_continental’, 'carrier', 
'product_measurements’, 'sale_shipment_cost', 'sale_shipment_cost_weight'

I update the module with
        trytond/bin/trytond-admin -v -dev  -c my_local_trytond.conf -d t44_2 -u 
symetrie

I test in postgresql :
        psql t44_2
        
psql (9.6.3)
Type "help" for help.

t44_2=# \d party_party
                                       Table "public.party_party"
   Column    |              Type              |                        
Modifiers                         
-------------+--------------------------------+----------------------------------------------------------
 id          | integer                        | not null default 
nextval('party_party_id_seq'::regclass)
 code        | character varying              | not null
 create_date | timestamp(6) without time zone | 
 write_uid   | integer                        | 
 create_uid  | integer                        | 
 write_date  | timestamp(6) without time zone | 
 active      | boolean                        | default false
 replaced_by | integer                        | 
 name        | character varying              | 
 siren       | character varying(9)           | 
 rebate      | numeric                        | 
 game_score  | numeric                        | 
 game_name   | character varying(100)         | 

Ok the two new fields were created.


2. I add similar fields to SaleLine:

# trytond/trytond/modules/symetrie/__init__.py

from trytond.pool import Pool
from party import *
from sale import *

def register():
    Pool.register(
        Party,
        SaleLine,
        module='symetrie', type_='model')

# trytond/trytond/modules/symetrie/party.py
(not changed)

# trytond/trytond/modules/symetrie/sale.py
from trytond.pool import PoolMeta, Pool
from trytond.model import Model, fields

__all__ = ['SaleLine']

class SaleLine:
    __metaclass__ = PoolMeta
    __name__ = 'sale.line'

    sym_char = fields.Char('Sym Char', 100)

# end

I update the module with
        trytond/bin/trytond-admin -v -dev  -c my_local_trytond.conf -d t44_2 -u 
symetrie
Complete output below [1].

I test in postgresql :
        psql t44_2
        
t44_2=# \d sale_line
                                        Table "public.sale_line"
    Column     |              Type              |                       
Modifiers                        
---------------+--------------------------------+--------------------------------------------------------
 id            | integer                        | not null default 
nextval('sale_line_id_seq'::regclass)
 create_date   | timestamp(6) without time zone | 
 sequence      | integer                        | 
 write_uid     | integer                        | 
 unit          | integer                        | 
 create_uid    | integer                        | 
 unit_price    | numeric                        | 
 note          | text                           | 
 type          | character varying              | not null
 product       | integer                        | 
 description   | text                           | not null
 write_date    | timestamp(6) without time zone | 
 sale          | integer                        | 
 quantity      | double precision               | 
 shipment_cost | numeric                        | 

I see no additional field.

[1] : complet output of trytond-admin -u :
65271 140735242597136 [2017-07-28 17:10:45,673] INFO 
trytond.backend.postgresql.database connect to "t44_2"
65271 140735242597136 [2017-07-28 17:10:48,146] INFO trytond.modules 
ir:registering classes
65271 140735242597136 [2017-07-28 17:10:48,146] INFO trytond.modules 
res:registering classes
65271 140735242597136 [2017-07-28 17:10:48,146] INFO trytond.modules 
tests:registering classes
65271 140735242597136 [2017-07-28 17:10:48,146] INFO trytond.modules 
country:registering classes
65271 140735242597136 [2017-07-28 17:10:48,161] INFO trytond.modules 
dashboard:registering classes
65271 140735242597136 [2017-07-28 17:10:48,173] INFO trytond.modules 
authentication_sms:registering classes
65271 140735242597136 [2017-07-28 17:10:48,188] INFO trytond.modules 
currency:registering classes
65271 140735242597136 [2017-07-28 17:10:48,203] INFO trytond.modules 
ldap_authentication:registering classes
65271 140735242597136 [2017-07-28 17:10:49,187] INFO trytond.modules 
party:registering classes
65271 140735242597136 [2017-07-28 17:10:49,395] INFO trytond.modules 
bank:registering classes
65271 140735242597136 [2017-07-28 17:10:49,442] INFO trytond.modules 
party_relationship:registering classes
65271 140735242597136 [2017-07-28 17:10:49,457] INFO trytond.modules 
symetrie:registering classes
65271 140735242597136 [2017-07-28 17:10:49,460] INFO trytond.modules 
company:registering classes
65271 140735242597136 [2017-07-28 17:10:49,801] INFO trytond.modules 
party_siret:registering classes
65271 140735242597136 [2017-07-28 17:10:49,806] INFO trytond.modules 
google_maps:registering classes
65271 140735242597136 [2017-07-28 17:10:49,807] INFO trytond.modules 
web_user:registering classes
65271 140735242597136 [2017-07-28 17:10:49,825] INFO trytond.modules 
company_work_time:registering classes
65271 140735242597136 [2017-07-28 17:10:49,829] INFO trytond.modules 
account:registering classes
65271 140735242597136 [2017-07-28 17:10:50,013] INFO trytond.modules 
product:registering classes
65271 140735242597136 [2017-07-28 17:10:50,047] INFO trytond.modules 
product_classification:registering classes
65271 140735242597136 [2017-07-28 17:10:50,056] INFO trytond.modules 
account_be:registering classes
65271 140735242597136 [2017-07-28 17:10:50,059] INFO trytond.modules 
product_attribute:registering classes
65271 140735242597136 [2017-07-28 17:10:50,061] INFO trytond.modules 
product_cost_history:registering classes
65271 140735242597136 [2017-07-28 17:10:50,064] INFO trytond.modules 
account_dunning:registering classes
65271 140735242597136 [2017-07-28 17:10:50,082] INFO trytond.modules 
product_price_list:registering classes
65271 140735242597136 [2017-07-28 17:10:50,098] INFO trytond.modules 
carrier:registering classes
65271 140735242597136 [2017-07-28 17:10:50,114] INFO trytond.modules 
timesheet:registering classes
65271 140735242597136 [2017-07-28 17:10:50,159] INFO trytond.modules 
analytic_account:registering classes
65271 140735242597136 [2017-07-28 17:10:50,191] INFO trytond.modules 
account_product:registering classes
65271 140735242597136 [2017-07-28 17:10:50,222] INFO trytond.modules 
stock:registering classes
65271 140735242597136 [2017-07-28 17:10:50,347] INFO trytond.modules 
product_measurements:registering classes
65271 140735242597136 [2017-07-28 17:10:50,362] INFO trytond.modules 
customs:registering classes
65271 140735242597136 [2017-07-28 17:10:50,391] INFO trytond.modules 
account_de_skr03:registering classes
65271 140735242597136 [2017-07-28 17:10:50,392] INFO trytond.modules 
stock_split:registering classes
65271 140735242597136 [2017-07-28 17:10:50,402] INFO trytond.modules 
stock_lot:registering classes
65271 140735242597136 [2017-07-28 17:10:50,427] INFO trytond.modules 
account_invoice:registering classes
65271 140735242597136 [2017-07-28 17:10:50,530] INFO trytond.modules 
product_cost_fifo:registering classes
65271 140735242597136 [2017-07-28 17:10:50,553] INFO trytond.modules 
production:registering classes
65271 140735242597136 [2017-07-28 17:10:50,633] INFO trytond.modules 
timesheet_cost:registering classes
65271 140735242597136 [2017-07-28 17:10:50,649] INFO trytond.modules 
account_credit_limit:registering classes
65271 140735242597136 [2017-07-28 17:10:50,669] INFO trytond.modules 
account_dunning_letter:registering classes
65271 140735242597136 [2017-07-28 17:10:50,691] INFO trytond.modules 
stock_forecast:registering classes
65271 140735242597136 [2017-07-28 17:10:50,714] INFO trytond.modules 
stock_package:registering classes
65271 140735242597136 [2017-07-28 17:10:50,736] INFO trytond.modules 
stock_inventory_location:registering classes
65271 140735242597136 [2017-07-28 17:10:50,739] INFO trytond.modules 
account_stock_continental:registering classes
65271 140735242597136 [2017-07-28 17:10:50,789] INFO trytond.modules 
project:registering classes
65271 140735242597136 [2017-07-28 17:10:50,811] INFO trytond.modules 
product_classification_taxonomic:registering classes
65271 140735242597136 [2017-07-28 17:10:50,814] INFO trytond.modules 
stock_location_sequence:registering classes
65271 140735242597136 [2017-07-28 17:10:50,816] INFO trytond.modules 
account_statement:registering classes
65271 140735242597136 [2017-07-28 17:10:50,837] INFO trytond.modules 
account_invoice_stock:registering classes
65271 140735242597136 [2017-07-28 17:10:50,840] INFO trytond.modules 
account_stock_landed_cost:registering classes
65271 140735242597136 [2017-07-28 17:10:50,857] INFO trytond.modules 
account_invoice_rebate:registering classes
65271 140735242597136 [2017-07-28 17:10:50,873] INFO trytond.modules 
account_payment:registering classes
65271 140735242597136 [2017-07-28 17:10:50,905] INFO trytond.modules 
account_dunning_fee:registering classes
65271 140735242597136 [2017-07-28 17:10:50,921] INFO trytond.modules 
account_invoice_line_standalone:registering classes
65271 140735242597136 [2017-07-28 17:10:50,923] INFO trytond.modules 
stock_product_location:registering classes
65271 140735242597136 [2017-07-28 17:10:50,928] INFO trytond.modules 
account_deposit:registering classes
65271 140735242597136 [2017-07-28 17:10:50,957] INFO trytond.modules 
account_fr:registering classes
65271 140735242597136 [2017-07-28 17:10:50,972] INFO trytond.modules 
stock_lot_sled:registering classes
65271 140735242597136 [2017-07-28 17:10:50,989] INFO trytond.modules 
account_invoice_history:registering classes
65271 140735242597136 [2017-07-28 17:10:50,994] INFO trytond.modules 
account_invoice_correction:registering classes
65271 140735242597136 [2017-07-28 17:10:50,997] INFO trytond.modules 
stock_shipment_measurements:registering classes
65271 140735242597136 [2017-07-28 17:10:51,012] INFO trytond.modules 
production_split:registering classes
65271 140735242597136 [2017-07-28 17:10:51,026] INFO trytond.modules 
project_plan:registering classes
65271 140735242597136 [2017-07-28 17:10:51,043] INFO trytond.modules 
account_stock_anglo_saxon:registering classes
65271 140735242597136 [2017-07-28 17:10:51,074] INFO trytond.modules 
account_payment_stripe:registering classes
65271 140735242597136 [2017-07-28 17:10:52,166] INFO trytond.modules 
account_payment_clearing:registering classes
65271 140735242597136 [2017-07-28 17:10:52,211] INFO trytond.modules 
purchase:registering classes
65271 140735242597136 [2017-07-28 17:10:52,323] INFO trytond.modules 
account_stock_landed_cost_weight:registering classes
65271 140735242597136 [2017-07-28 17:10:52,326] INFO trytond.modules 
sale:registering classes
65271 140735242597136 [2017-07-28 17:10:52,427] INFO trytond.modules 
project_revenue:registering classes
65271 140735242597136 [2017-07-28 17:10:52,443] INFO trytond.modules 
sale_credit_limit:registering classes
65271 140735242597136 [2017-07-28 17:10:52,447] INFO trytond.modules 
purchase_shipment_cost:registering classes
65271 140735242597136 [2017-07-28 17:10:52,462] INFO trytond.modules 
sale_shipment_cost:registering classes
65271 140735242597136 [2017-07-28 17:10:52,491] INFO trytond.modules 
sale_rebate:registering classes
65271 140735242597136 [2017-07-28 17:10:52,499] INFO trytond.modules 
sale_shipment_grouping:registering classes
65271 140735242597136 [2017-07-28 17:10:52,504] INFO trytond.modules 
account_tax_rule_country:registering classes
65271 140735242597136 [2017-07-28 17:10:52,509] INFO trytond.modules 
sale_opportunity:registering classes
65271 140735242597136 [2017-07-28 17:10:52,532] INFO trytond.modules 
commission:registering classes
65271 140735242597136 [2017-07-28 17:10:52,565] INFO trytond.modules 
stock_supply_day:registering classes
65271 140735242597136 [2017-07-28 17:10:52,567] INFO trytond.modules 
sale_invoice_grouping:registering classes
65271 140735242597136 [2017-07-28 17:10:52,570] INFO trytond.modules 
purchase_request:registering classes
65271 140735242597136 [2017-07-28 17:10:52,595] INFO trytond.modules 
account_asset:registering classes
65271 140735242597136 [2017-07-28 17:10:52,680] INFO trytond.modules 
sale_complaint:registering classes
65271 140735242597136 [2017-07-28 17:10:52,698] INFO trytond.modules 
purchase_invoice_line_standalone:registering classes
65271 140735242597136 [2017-07-28 17:10:52,713] INFO trytond.modules 
sale_price_list:registering classes
65271 140735242597136 [2017-07-28 17:10:52,719] INFO trytond.modules 
sale_subscription:registering classes
65271 140735242597136 [2017-07-28 17:10:52,755] INFO trytond.modules 
account_payment_sepa:registering classes
65271 140735242597136 [2017-07-28 17:10:52,858] INFO trytond.modules 
purchase_requisition:registering classes
65271 140735242597136 [2017-07-28 17:10:52,874] INFO trytond.modules 
sale_extra:registering classes
65271 140735242597136 [2017-07-28 17:10:52,890] INFO trytond.modules 
stock_package_shipping:registering classes
65271 140735242597136 [2017-07-28 17:10:52,906] INFO trytond.modules 
stock_supply:registering classes
65271 140735242597136 [2017-07-28 17:10:52,958] INFO trytond.modules 
project_invoice:registering classes
65271 140735242597136 [2017-07-28 17:10:52,977] INFO trytond.modules 
carrier_percentage:registering classes
65271 140735242597136 [2017-07-28 17:10:52,982] INFO trytond.modules 
sale_promotion:registering classes
65271 140735242597136 [2017-07-28 17:10:52,997] INFO trytond.modules 
product_price_list_dates:registering classes
65271 140735242597136 [2017-07-28 17:10:53,001] INFO trytond.modules 
carrier_weight:registering classes
65271 140735242597136 [2017-07-28 17:10:53,020] INFO trytond.modules 
product_price_list_party_rebate:registering classes
65271 140735242597136 [2017-07-28 17:10:53,024] INFO trytond.modules 
analytic_invoice:registering classes
65271 140735242597136 [2017-07-28 17:10:53,033] INFO trytond.modules 
sale_supply:registering classes
65271 140735242597136 [2017-07-28 17:10:53,057] INFO trytond.modules 
account_payment_sepa_cfonb:registering classes
65271 140735242597136 [2017-07-28 17:10:53,060] INFO trytond.modules 
commission_waiting:registering classes
65271 140735242597136 [2017-07-28 17:10:53,066] INFO trytond.modules 
sale_stock_quantity:registering classes
65271 140735242597136 [2017-07-28 17:10:53,080] INFO trytond.modules 
analytic_sale:registering classes
65271 140735242597136 [2017-07-28 17:10:53,083] INFO trytond.modules 
stock_supply_forecast:registering classes
65271 140735242597136 [2017-07-28 17:10:53,085] INFO trytond.modules 
stock_package_shipping_dpd:registering classes
65271 140735242597136 [2017-07-28 17:10:53,555] INFO trytond.modules 
sale_supply_drop_shipment:registering classes
65271 140735242597136 [2017-07-28 17:10:53,599] INFO trytond.modules 
sale_advance_payment:registering classes
65271 140735242597136 [2017-07-28 17:10:53,625] INFO trytond.modules 
analytic_purchase:registering classes
65271 140735242597136 [2017-07-28 17:10:53,640] INFO trytond.modules 
stock_supply_production:registering classes
65271 140735242597136 [2017-07-28 17:10:53,664] INFO trytond.modules 
stock_package_shipping_ups:registering classes
65271 140735242597136 [2017-07-28 17:10:53,687] INFO trytond.modules 
production_routing:registering classes
65271 140735242597136 [2017-07-28 17:10:53,694] INFO trytond.modules 
production_work:registering classes
65271 140735242597136 [2017-07-28 17:10:53,725] INFO trytond.modules 
production_work_timesheet:registering classes
65271 140735242597136 [2017-07-28 17:10:53,735] INFO trytond.pool init pool for 
"t44_2"
65271 140735242597136 [2017-07-28 17:10:53,791] INFO trytond.modules ir
65271 140735242597136 [2017-07-28 17:10:53,792] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,084] INFO trytond.modules res
65271 140735242597136 [2017-07-28 17:10:54,085] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,161] INFO trytond.modules currency
65271 140735242597136 [2017-07-28 17:10:54,161] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,169] INFO trytond.modules country
65271 140735242597136 [2017-07-28 17:10:54,169] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,180] INFO trytond.modules party
65271 140735242597136 [2017-07-28 17:10:54,180] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,212] INFO trytond.modules company
65271 140735242597136 [2017-07-28 17:10:54,213] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,246] INFO trytond.modules symetrie
65271 140735242597136 [2017-07-28 17:10:54,246] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,250] INFO trytond.modules 
symetrie:register party.party
65271 140735242597136 [2017-07-28 17:10:54,382] INFO trytond.modules party_siret
65271 140735242597136 [2017-07-28 17:10:54,382] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,390] INFO trytond.modules product
65271 140735242597136 [2017-07-28 17:10:54,390] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,408] INFO trytond.modules account
65271 140735242597136 [2017-07-28 17:10:54,412] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,563] INFO trytond.modules 
account_product
65271 140735242597136 [2017-07-28 17:10:54,564] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,594] INFO trytond.modules stock
65271 140735242597136 [2017-07-28 17:10:54,596] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,689] INFO trytond.modules 
product_measurements
65271 140735242597136 [2017-07-28 17:10:54,689] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,719] INFO trytond.modules 
product_price_list
65271 140735242597136 [2017-07-28 17:10:54,719] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,723] INFO trytond.modules carrier
65271 140735242597136 [2017-07-28 17:10:54,724] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,728] INFO trytond.modules 
account_invoice
65271 140735242597136 [2017-07-28 17:10:54,728] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,793] INFO trytond.modules 
account_stock_continental
65271 140735242597136 [2017-07-28 17:10:54,793] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,858] INFO trytond.modules 
product_price_list_party_rebate
65271 140735242597136 [2017-07-28 17:10:54,858] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,868] INFO trytond.modules account_fr
65271 140735242597136 [2017-07-28 17:10:54,869] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,877] INFO trytond.modules 
account_statement
65271 140735242597136 [2017-07-28 17:10:54,877] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,894] INFO trytond.modules 
account_invoice_stock
65271 140735242597136 [2017-07-28 17:10:54,894] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,911] INFO trytond.modules 
account_invoice_history
65271 140735242597136 [2017-07-28 17:10:54,912] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:54,938] INFO trytond.modules sale
65271 140735242597136 [2017-07-28 17:10:54,938] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:55,031] INFO trytond.modules 
sale_shipment_cost
65271 140735242597136 [2017-07-28 17:10:55,031] INFO trytond.pool setup pool 
for "t44_2"
65271 140735242597136 [2017-07-28 17:10:55,055] INFO trytond.modules 
history:update party.party
65271 140735242597136 [2017-07-28 17:10:55,081] INFO trytond.modules all 
modules loaded



-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/D06F84CC-8BC1-401D-B854-772B59855FCC%40symetrie.com.

Reply via email to