[FIX][IMP] stock: set picking_warn as non required

When reinitializing modules it is impossible to create partners if
stock is installed because picking_warn field has a required column
but no default value if the module does not depend from stock. Use
case is trying to run test_mail tests with stock installed.

As this field is not business critical it is now not required. As there
is a default value behavior should not change for users.
This commit is contained in:
Thibault Delavallée
2017-12-20 13:53:45 +01:00
parent 06a02ae4c2
commit dd47abdcc3
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -14,6 +14,6 @@ class Partner(models.Model):
property_stock_supplier = fields.Many2one(
'stock.location', string="Vendor Location", company_dependent=True,
help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner")
picking_warn = fields.Selection(WARNING_MESSAGE, 'Stock Picking', help=WARNING_HELP, default='no-message', required=True)
picking_warn = fields.Selection(WARNING_MESSAGE, 'Stock Picking', help=WARNING_HELP, default='no-message')
# TDE FIXME: expand this message / help
picking_warn_msg = fields.Text('Message for Stock Picking')
+1 -1
View File
@@ -453,7 +453,7 @@ class Picking(models.Model):
self.location_id = location_id
self.location_dest_id = location_dest_id
# TDE CLEANME move into onchange_partner_id
if self.partner_id:
if self.partner_id and self.partner_id.picking_warn:
if self.partner_id.picking_warn == 'no-message' and self.partner_id.parent_id:
partner = self.partner_id.parent_id
elif self.partner_id.picking_warn not in ('no-message', 'block') and self.partner_id.parent_id.picking_warn == 'block':
+1 -1
View File
@@ -31,7 +31,7 @@
<separator string="Warning on the Picking" colspan="4"/>
<field name="picking_warn" nolabel="1" />
<field name="picking_warn_msg" colspan="3" nolabel="1"
attrs="{'required':[('picking_warn','!=','no-message')],'readonly':[('picking_warn','=','no-message')]}"/>
attrs="{'required':[('picking_warn', '!=', False), ('picking_warn','!=','no-message')],'readonly':[('picking_warn','=','no-message')]}"/>
</group>
</page>
</field>