From 815484868cf689f9c59c5468a69c273c5693efe0 Mon Sep 17 00:00:00 2001 From: Kaylie Kipe Date: Tue, 18 May 2021 13:55:47 -0700 Subject: [PATCH] [WIP] delivery_stamps: Added international service types and basic scaffolding for customs information --- delivery_stamps/models/delivery_stamps.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/delivery_stamps/models/delivery_stamps.py b/delivery_stamps/models/delivery_stamps.py index 2da10557..6b08b14a 100644 --- a/delivery_stamps/models/delivery_stamps.py +++ b/delivery_stamps/models/delivery_stamps.py @@ -49,7 +49,10 @@ class ProviderStamps(models.Model): stamps_password = fields.Char(string='Stamps.com Password', groups='base.group_system') stamps_service_type = fields.Selection([('US-FC', 'First-Class'), + ('US-FCI', 'First-Class International'), ('US-PM', 'Priority'), + ('US-PMI', 'Priority Mail International'), + ('US-EMI', ' Priority Mail Express International'), ], required=True, string="Service Type", default="US-PM") stamps_default_packaging_id = fields.Many2one('product.packaging', string='Default Package Type') @@ -266,6 +269,22 @@ class ProviderStamps(models.Model): to_address.ZIPCodeAddOn = to_zip_pieces[1] to_address = service.get_address(to_address).Address +#This is where the customs information goes + customs = service.create_customs() + customs.Description = "Merchandise" + +#This is where the customs lines go; need one line per product line in the package. Should create an array using +# create_array_of_customs_lines for all lines in the package. Note that anything currently filled in is the field +#name on the product and that CountryOfOrigin is not an existing field on products (may need added for implementation). + customs_line = service.create_customs_lines() + customs_line.Quantity = qty_done + customs_line.Value = lst_price + customs_line.WeightLb = + customs_line.WeightOz = + customs_line.HSTariffNumber = hs_code + customs_line.CountryOfOrigin = + customs_line.sku = default_code + try: for txn_id, shipping in shippings: rates = service.get_rates(shipping)