>We have tried to generate the error and the only way we could do it was to change the view of sale.shop and set the warehouse_id field to be 'not required'.
It is not the only way. If you went to Stock management\Configuration\Warehouses and just remove the warehouse relate to the shop, he field under discussion of shop object become clear. The are no ORM database constraints that disable to do such a thing. «required="1"» in xml acts only when a users tries to save particular form, with no database relations checking.
Maybe in my case somebody removed id while testing and then added back.
So, if you are so so much interested in making this situation impossible, you should add a database constraint in field declaration in sale.py:
warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True),
insread
warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
Here it is:
< field name="name" select="1"/>
< field name="warehouse_id" required="1" select="1"/>
< separator colspan="4" string= "Accounting" />
< field name="payment_ default_ id"/>
< field domain= "[('type' ,'=','sale' )]" name="pricelist_id" select="1"/>
< field name="project_id" select="1"/>
< separator colspan="4" string="Payment accounts"/>
< field colspan="4" name="payment_ account_ id" nolabel="1"/>
</form>
<?xml version="1.0"?>
<form string="Sale Shop">
>We have tried to generate the error and the only way we could do it was to change the view of sale.shop and set the warehouse_id field to be 'not required'.
It is not the only way. If you went to Stock management\ Configuration\ Warehouses and just remove the warehouse relate to the shop, he field under discussion of shop object become clear. The are no ORM database constraints that disable to do such a thing. «required="1"» in xml acts only when a users tries to save particular form, with no database relations checking.
Maybe in my case somebody removed id while testing and then added back.
So, if you are so so much interested in making this situation impossible, you should add a database constraint in field declaration in sale.py: many2one( 'stock. warehouse' , 'Warehouse', required=True), many2one( 'stock. warehouse' , 'Warehouse'),
warehouse_id': fields.
insread
warehouse_id': fields.