[FIX] stock: move company initial setup logic in model
Followup of 4e71bd5caf
This commit is contained in:
@@ -1,6 +1,3 @@
|
|||||||
-
|
|
||||||
!python {model: res.partner, id: base.main_partner}: |
|
|
||||||
main_warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
|
||||||
-
|
-
|
||||||
!python {model: ir.model.data, id: False}: |
|
!python {model: ir.model.data, id: False}: |
|
||||||
main_warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
main_warehouse = self.env['stock.warehouse'].browse(ref('warehouse0'))
|
||||||
@@ -28,7 +25,3 @@
|
|||||||
companies = self.search([('internal_transit_location_id', '=', False)])
|
companies = self.search([('internal_transit_location_id', '=', False)])
|
||||||
for company in companies:
|
for company in companies:
|
||||||
company.create_transit_location()
|
company.create_transit_location()
|
||||||
internal_transit = company.internal_transit_location_id.id
|
|
||||||
warehouses = self.env['stock.warehouse'].search([('partner_id', '=', company.partner_id.id)])
|
|
||||||
warehouses.mapped('partner_id').with_context(force_company=company.id).write({'property_stock_customer': internal_transit, 'property_stock_supplier': internal_transit})
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ class Company(models.Model):
|
|||||||
location.sudo().write({'company_id': self.id})
|
location.sudo().write({'company_id': self.id})
|
||||||
self.write({'internal_transit_location_id': location.id})
|
self.write({'internal_transit_location_id': location.id})
|
||||||
|
|
||||||
|
warehouses = self.env['stock.warehouse'].search([('partner_id', '=', self.partner_id.id)])
|
||||||
|
warehouses.mapped('partner_id').with_context(force_company=self.id).write({
|
||||||
|
'property_stock_customer': location.id,
|
||||||
|
'property_stock_supplier': location.id,
|
||||||
|
})
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
company = super(Company, self).create(vals)
|
company = super(Company, self).create(vals)
|
||||||
|
|||||||
Reference in New Issue
Block a user