Skip to content

Commit

Permalink
[FIX] point_of_sale: fetch active warehouse pos type only
Browse files Browse the repository at this point in the history
revert the commit
as when we fetch archived warehouse's pos type
it will raise error for other source or destination
loction for newly created stock operation type like

even functinally also there is no need to fetch
archived warehouse's operation type.
```
quality Control
cross Dock,
Storage type
```
we got this error during upgrade :
```
File "/home/odoo/src/odoo/saas-17.4/odoo/sql_db.py", line 347, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.NotNullViolation: null value in column "default_location_src_id" of relation "stock_picking_type" violates not-null constraint
DETAIL:  Failing row contains (33, 0, 28, 56, null, null, null, 4, null, null, 1, 1, 1, QC, internal, at_confirm, FBAQC, ask, {"en_US": "Quality Control"}, null, f, f, t, null, f, null, 2024-10-16 05:14:53.18448, 2024-10-16 05:14:53.18448, optional, optional, no, optional, null, null, t, null, null, 2x7xprice, 4x12_lots, pdf, null, null, null, null, null, null, null, null, null, t, null).
```

due to this two fix:
https://github.com/odoo/odoo/pull/151719/commits
https://github.com/odoo/odoo/pull/175838/files

so we need to avoid to fetch archived warehouse's picking type.

ref:
odoo/upgrade#6631

closes odoo#185244

Signed-off-by: Adrien Guilliams (adgu) <[email protected]>
  • Loading branch information
atp-odoo committed Nov 27, 2024
1 parent c7fa371 commit 755c180
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/point_of_sale/models/pos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _default_warehouse_id(self):
return self.env['stock.warehouse'].search(self.env['stock.warehouse']._check_company_domain(self.env.company), limit=1).id

def _default_picking_type_id(self):
return self.env['stock.warehouse'].with_context(active_test=False).search(self.env['stock.warehouse']._check_company_domain(self.env.company), limit=1).pos_type_id.id
return self.env['stock.warehouse'].search(self.env['stock.warehouse']._check_company_domain(self.env.company), limit=1).pos_type_id.id

def _default_sale_journal(self):
return self.env['account.journal'].search([
Expand Down
2 changes: 1 addition & 1 deletion addons/point_of_sale/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _get_picking_type_create_values(self, max_sequence):

@api.model
def _create_missing_pos_picking_types(self):
warehouses = self.env['stock.warehouse'].with_context(active_test=False).search([('pos_type_id', '=', False)])
warehouses = self.env['stock.warehouse'].search([('pos_type_id', '=', False)])
for warehouse in warehouses:
new_vals = warehouse._create_or_update_sequences_and_picking_types()
warehouse.write(new_vals)

0 comments on commit 755c180

Please sign in to comment.