[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#133637 X-original-commit: d57bffae3b13a58580dc82db878ce8809878ff04 Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
This commit is contained in:
@@ -73,8 +73,7 @@ class StockPickingType(models.Model):
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
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._create_proxy_user(cls.company_data['company'], 'demo')
|
||||
|
||||
@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):
|
||||
"""
|
||||
|
||||
@@ -91,6 +91,13 @@ class TestItEdiDDT(TestItEdi):
|
||||
}
|
||||
])
|
||||
|
||||
@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_deferred_invoice(self):
|
||||
""" Create a sale order with multiple DDTs, and create an invoice with a later date.
|
||||
The export has to have the TipoDocumento TD24 for Deferred Invoice.
|
||||
|
||||
Reference in New Issue
Block a user