Just wondering how much interest there might be in a couple of US-specific modules (sorry they are managed using git
right now, but I’m told they can be converted ). These in-process modules are fruits of an earlier discussion.
Apologies for introducing both at the same time, but they are related:
country_uscensus
A module that augments the country.subdivision
model with FIPS and GNIS codes and imports county and local subdivisions of the United States. Data come from the US Census Bureau.
Design questions:
- Is
country.subdivision
the best place to add this kind of data? Or would creating a new model be better? I tried both approaches, but this seemed the simplest and, at least theoretically, the most compatible with other modules. - It appears the client loads all its subdivisions when viewing a country (
country_view_form
). If subdivisions for all US states are imported, this adds up to about 36k subdivision records, so it might be good to have something, perhaps a paging mechanism or limit for this view (though this doesn’t appear to be possible?). I tried to add achilds
(One2Many) field tocountry.subdivision
and override thesubdivision_form
view with afield_childs
to turn it into a nesting tree, which fits the data well, but is there a way to do that without manual intervention? (I see that the product_classification and product_classification_taxonomic modules do something like this, so I can take a closer look unless there is a better way to approach this point generally.)
account_us_sstp
A module that manages sales and use tax for streamlined states, i.e. those that are participating in the Streamlined Sales Tax Project. Tax data are imported as tax, tax rule, tax code, and tax boundary records. The customer tax rule is dynamically resolved using the sale date along with the warehouse’s origin and customer’s destination addresses. By design, it will only attempt to resolve a customer tax rule if the customer tax rule and the default customer tax rule (in Account Configuration) are not already set.
Design questions and concessions:
- Dynamic resolution of customer tax rule is not yet implemented for the
web_shop
andweb_shop_product_data_feed
modules. Tax._amount_where
did not give the option to include a join on theaccount_tax
table, so I decided to override theTax.get_amount
query method and introduce an additional methodTax._amount_where_tax
that included the table. It would be nice if theTax._amount_where
method exposed theaccount_tax
table so I would just have to override the one method.- On
InvoiceTax
there is no analog ofInvoiceLine._compute_taxes()
so I had to override itsget_move_lines()
method to intercept the computedTaxLine
s. Would be nicer to override a more fine-grained method, but not a big deal.
Overall this was a very fun project to work on to get my feet wet with Tryton. Any comments welcome! If there is enough interest I can post more explicit rationale for each separately on the Feature board (if that is the right process?).
P.S. The US address verification module mentioned earlier will be a separate (potential) module. While it will be useful for US addresses, it didn’t turn out to be required for these two modules’ functionality.