diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index c37960d6..e31ccb93 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -31,7 +31,7 @@ class AccountInvoiceLine(models.Model): @api.model def create(self, vals): - if vals.get('intrastat_id', None) is None: + if not vals.get('intrastat_id', False): if vals.get('lot_id', False): vals.update(intrastat_id=self.env['stock.production.lot'].browse(vals['lot_id']).intrastat_id.id) elif vals.get('product_id', False): @@ -57,7 +57,7 @@ class AccountInvoiceLine(models.Model): for record in self: lot_id = record.lot_id if 'lot_id' not in vals else vals.get('lot_id', False) if vals.get('intrastat_id', False) and lot_id: - self.env['stock.production.lot'].browse([vals.get('lot_id', False)]).write({ + self.env['stock.production.lot'].browse([lot_id.id]).write({ 'intrastat_id': vals.get('intrastat_id') }) elif vals.get('intrastat_id', False) and not lot_id: diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index d93b5c5b..bb02f153 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -397,7 +397,7 @@ class SaleOrderLine(models.Model): @api.model def create(self, vals): - if vals.get('intrastat_id', None) is None: + if not vals.get('intrastat_id', False): if vals.get('lot_id', False): vals.update(intrastat_id=self.env['stock.production.lot'].browse(vals['lot_id']).intrastat_id.id) elif vals.get('product_id', False): @@ -409,7 +409,7 @@ class SaleOrderLine(models.Model): for record in self: lot_id = record.lot_id if 'lot_id' not in vals else vals.get('lot_id', False) if vals.get('intrastat_id', False) and lot_id: - self.env['stock.production.lot'].browse([vals.get('lot_id', False)]).write({ + self.env['stock.production.lot'].browse([lot_id.id]).write({ 'intrastat_id': vals.get('intrastat_id') }) elif vals.get('intrastat_id', False) and not lot_id: diff --git a/setup/lib/config.py b/setup/lib/config.py index 60ffca94..2f7bf629 100644 --- a/setup/lib/config.py +++ b/setup/lib/config.py @@ -126,6 +126,7 @@ class Config(object): 'dp_reports_sale', 'dp_reports_account', 'dp_reports_purchase', + 'dp_reports_stock', # 'dp_reports_stock', 'account_cancel', 'stock',