David BEAL (ak) has proposed merging lp:~akretion-team/carriers-deliveries/7-split-default-option-state-from-deliv-method-dbl into lp:carriers-deliveries.
Requested reviews: Yannick Vaucher @ Camptocamp (yvaucher-c2c) For more details, see: https://code.launchpad.net/~akretion-team/carriers-deliveries/7-split-default-option-state-from-deliv-method-dbl/+merge/224027 Improve : split state field in two boolean fields with the same feature -- https://code.launchpad.net/~akretion-team/carriers-deliveries/7-split-default-option-state-from-deliv-method-dbl/+merge/224027 Your team Stock and Logistic Core Editors is subscribed to branch lp:carriers-deliveries.
=== modified file 'base_delivery_carrier_label/delivery.py' --- base_delivery_carrier_label/delivery.py 2014-03-31 08:09:39 +0000 +++ base_delivery_carrier_label/delivery.py 2014-06-21 17:15:39 +0000 @@ -32,12 +32,15 @@ 'Partner Carrier'), 'name': fields.char( 'Name', + readonly=True, size=64), 'code': fields.char( 'Code', + readonly=True, size=64), 'description': fields.char( 'Description', + readonly=True, help="Allow to define a more complete description " "than in the name field."), } @@ -55,21 +58,26 @@ _inherits = {'delivery.carrier.template.option': 'tmpl_option_id'} _columns = { - 'state': fields.selection( - (('mandatory', 'Mandatory'), - ('default_option', 'Optional by Default'), - ('option', 'Optional'), - ), - string='Option Configuration', - help="Ensure you add and define correctly all your options or those won't " - "be available for the packager\n" - "- Mandatory: This option will be copied on carrier and cannot be removed\n" - "- Optional by Default: This option will be copied but can be removed\n" - "- Optional: This option can be added later by the user on the Delivery Order."), + 'mandatory': fields.boolean( + 'Mandatory', + help="If checked, this option is necessarily applied to the picking"), + 'by_default': fields.boolean( + 'Applied by Default', + help="By check, user can choose to apply this option " + "to each pickings\n using this delivery method"), 'tmpl_option_id': fields.many2one( 'delivery.carrier.template.option', string='Option', required=True, ondelete="cascade"), 'carrier_id': fields.many2one('delivery.carrier', 'Carrier'), + 'readonly_flag': fields.boolean( + 'Readonly Flag', + help="When True, help to prevent the user to modify some fields " + "option (if attribute is defined in the view)"), + } + + _defaults = { + 'readonly_flag': False, + 'by_default': False, } === modified file 'base_delivery_carrier_label/delivery_view.xml' --- base_delivery_carrier_label/delivery_view.xml 2014-03-12 17:15:06 +0000 +++ base_delivery_carrier_label/delivery_view.xml 2014-06-21 17:15:39 +0000 @@ -35,10 +35,15 @@ <field name="model">delivery.carrier.option</field> <field name="arch" type="xml"> <form string="delivery_carrier_option"> - <field name="state"/> - <field name="tmpl_option_id"/> - <newline/> - <field name="description" colspan="4" readonly="True"/> + <group col="4"> + <field name="mandatory" attrs="{'readonly': [('readonly_flag','=',True)]}"/> + <field name="by_default" attrs="{'invisible': [('mandatory', '=', True)]}"/> + <field name="readonly_flag" attrs="{'invisible': True}"/> + <field name="tmpl_option_id" colspan="4" + attrs="{'readonly': [('readonly_flag','=',True)]}"/> + <newline/> + <field name="description" colspan="4" readonly="True"/> + </group> </form> </field> </record> @@ -49,7 +54,7 @@ <field name="type">tree</field> <field name="arch" type="xml"> <tree string="delivery_carrier_option"> - <field name="state" /> + <field name="mandatory" /> <field name="tmpl_option_id" /> <field name="code" readonly="1"/> </tree> === modified file 'base_delivery_carrier_label/stock.py' --- base_delivery_carrier_label/stock.py 2014-06-17 11:16:42 +0000 +++ base_delivery_carrier_label/stock.py 2014-06-21 17:15:39 +0000 @@ -163,7 +163,8 @@ available_option_ids = [] for available_option in carrier.available_option_ids: available_option_ids.append(available_option.id) - if available_option.state in ['default_option', 'mandatory']: + if available_option.mandatory is True \ + or available_option.by_default is True: default_option_ids.append(available_option.id) res = { 'value': {'carrier_type': carrier.type, @@ -182,7 +183,7 @@ return res carrier = carrier_obj.browse(cr, uid, carrier_id, context=context) for available_option in carrier.available_option_ids: - if (available_option.state == 'mandatory' + if (available_option.mandatory is True and not available_option.id in option_ids[0][2]): res['warning'] = { 'title': _('User Error !'),
-- Mailing list: https://launchpad.net/~openerp-community-reviewer Post to : openerp-community-reviewer@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community-reviewer More help : https://help.launchpad.net/ListHelp