@@ -43,3 +43,38 @@ def test_operating_unit_assignment_via_write(self):
4343 self .assertFalse (cfg .operating_unit_ids )
4444 cfg .write ({"operating_unit_ids" : [Command .set ([self .ou .id ])]})
4545 self .assertIn (self .ou , cfg .operating_unit_ids )
46+
47+ def test_operating_unit_unset_via_write (self ):
48+ """Ensure operating_unit_ids can be unset via write."""
49+ cfg = self .env ["pos.config" ].create (
50+ {
51+ "name" : "POS Unset Test" ,
52+ "company_id" : self .company .id ,
53+ "operating_unit_ids" : [Command .set ([self .ou .id ])],
54+ }
55+ )
56+ self .assertIn (self .ou , cfg .operating_unit_ids )
57+ cfg .write ({"operating_unit_ids" : [Command .set ([])]})
58+ self .assertFalse (cfg .operating_unit_ids )
59+
60+ def test_assign_multiple_operating_units (self ):
61+ """Assign multiple operating units to a config and verify both are present."""
62+ partner2 = self .env ["res.partner" ].create ({"name" : "OU2 Partner" })
63+ ou2 = self .env ["operating.unit" ].create (
64+ {
65+ "name" : "OU 2" ,
66+ "code" : "OU2" ,
67+ "company_id" : self .company .id ,
68+ "partner_id" : partner2 .id ,
69+ }
70+ )
71+ cfg = self .env ["pos.config" ].create (
72+ {
73+ "name" : "POS Multi OU" ,
74+ "company_id" : self .company .id ,
75+ "operating_unit_ids" : [Command .set ([self .ou .id , ou2 .id ])],
76+ }
77+ )
78+ self .assertIn (self .ou , cfg .operating_unit_ids )
79+ self .assertIn (ou2 , cfg .operating_unit_ids )
80+ self .assertEqual (len (cfg .operating_unit_ids ), 2 )
0 commit comments