Skip to content
Snippets Groups Projects
Commit 8a277a4c authored by Ricardo Gomes Rodrigues (rigr)'s avatar Ricardo Gomes Rodrigues (rigr)
Browse files

[FIX] l10n_it_stock_ddt: condition to create the l10n_it_ddt_sequence_id


The condition to create is wrongly evaluated and does not take into account
the country code and the picking type code. This commit fixes this by
reordering the conditions.

closes odoo/odoo#133161

X-original-commit: 30b00e5c
Signed-off-by: default avatarJosse Colpaert <jco@odoo.com>
Signed-off-by: default avatarRicardo Gomes Rodrigues (rigr) <rigr@odoo.com>
parent 6852152e
Branches
Tags
No related merge requests found
......@@ -73,8 +73,7 @@ class StockPickingType(models.Model):
@api.model
def create(self, vals):
company = self.env['res.company'].browse(vals.get('company_id', False)) or self.env.company
if 'l10n_it_ddt_sequence_id' not in vals or not vals['l10n_it_ddt_sequence_id'] and vals['code'] == 'outgoing' \
and company.country_id.code == 'IT':
if company.country_id.code == 'IT' and vals['code'] == 'outgoing' and ('l10n_it_ddt_sequence_id' not in vals or not vals['l10n_it_ddt_sequence_id']):
ir_seq_name, ir_seq_prefix = self._get_dtt_ir_seq_vals(vals.get('warehouse_id'), vals['sequence_code'])
vals['l10n_it_ddt_sequence_id'] = self.env['ir.sequence'].create({
'name': ir_seq_name,
......
......@@ -36,6 +36,12 @@ class TestDDT(TestSaleCommon):
# Needed when `l10n_it_edi_sdiscoop` is installed
settings.button_create_proxy_user()
@classmethod
def setup_company_data(cls, company_name, **kwargs):
return super().setup_company_data(company_name, **{
**kwargs,
'country_id': cls.env.ref('base.it').id,
})
def test_ddt_flow(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment