You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This field "parcel_sequence" allows you to add a value to T400 which is mandatory for Belgium.
The value of the field parcel_sequence is calculated on Odoo module like this:
vals["parcel_sequence"] = self.calc_parcel_num() --> I added this line in the inheritance of the function _gls_fr_glsbox_get_parcel(self, picking)
@api.model
def _get_sequence(self):
sequence = self.env["ir.sequence"].next_by_code("delivery_carrier_gls")
if not sequence:
raise UserError(_("There is no sequence defined for the label GLS"))
return sequence
def calc_parcel_num(self):
start_num = (
self.env["ir.config_parameter"]
.sudo()
.get_param("PARCEL_NUM_START", 01234567890)
)
parcel_num = self._get_sequence()
num = int(start_num) + int(parcel_num)
num = str(num)
num = list(num)
num.reverse()
weighting = 3
sum_of_num = 0
for item in num:
sum_of_num += int(item) * weighting
if weighting == 3:
weighting = 1
else:
weighting = 3
sum_of_num += 1
check_num = int(math.ceil(sum_of_num / 10.0)) * 10 - sum_of_num
num.reverse()
num.append(str(check_num))
return "".join(num)
Hello @math0706 thanks for the contribution.
That's strange, GLS told me quite recenlty that its web service was country dependent. Meaning it works for France but not for spain for example.
So I guess there are not problem.
I'll make a quick test later to validate and I should be able to merge your PR quicky enough.
Where is the Odoo code you are talking about ?
FYI, in version 14, there is this module that manage the glsbox api : https://github.com/akretion/delivery-carrier/tree/14.0-mig-delivery_roulier_gls_fr
Which is used in production since the begging of the year (by a french company)
And https://github.com/akretion/delivery-carrier/tree/14-gls-rest-webservice
Which is not yet used in production but should be soon, it implements a more modern webservice which allow more stuff (multi parcel, ship worlwide, etc...)
GLS has still one more rest webservice, a kind of v2 I think but it is not implemented at all in roulier for now.
All of this for France, but maybe for Belgium too then...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This field "parcel_sequence" allows you to add a value to T400 which is mandatory for Belgium.
The value of the field parcel_sequence is calculated on Odoo module like this:
vals["parcel_sequence"] = self.calc_parcel_num() --> I added this line in the inheritance of the function _gls_fr_glsbox_get_parcel(self, picking)