Merge lp:~unifield-team/unifield-wm/sync-us-208 into lp:unifield-wm/sync
- sync-us-208
- Merge into sync_module_prod
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 576 |
Proposed branch: | lp:~unifield-team/unifield-wm/sync-us-208 |
Merge into: | lp:unifield-wm/sync |
Diff against target: |
185 lines (+76/-10) 6 files modified
msf_sync_data_server/data/sync_server.message_rule.csv (+3/-3) msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2) sync_remote_warehouse/wizard/setup_remote_warehouse.py (+2/-1) sync_so/so_po_common.py (+6/-2) sync_so/so_po_rw.py (+9/-2) sync_so/specific_xml_id.py (+54/-0) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-wm/sync-us-208 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Sync Reviewer | Pending | ||
Review via email: mp+260567@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'msf_sync_data_server/data/sync_server.message_rule.csv' |
2 | --- msf_sync_data_server/data/sync_server.message_rule.csv 2015-04-27 11:39:49 +0000 |
3 | +++ msf_sync_data_server/data/sync_server.message_rule.csv 2015-05-29 11:56:50 +0000 |
4 | @@ -20,9 +20,9 @@ |
5 | create_batch_object,TRUE,TRUE,"['name', 'xmlid_name', 'prefix', 'product_id/id', 'partner_id/id', 'date', 'ref','life_date','sequence_id','type']","[('name', '=', False)]",partner_id,MISSION,stock.picking.create_batch_number,stock.production.lot,Create Batch Object,1001,Valid |
6 | create_asset_object,TRUE,TRUE,"['name', 'xmlid_name', 'arrival_date', 'asset_type_id/id', 'partner_id/id', 'brand', 'comment', 'description', 'hq_ref', 'international_po', 'invo_certif_depreciation', 'invo_currency/id', 'invo_date', 'invo_donator_code', 'invo_num', 'invo_supplier', 'invo_value', 'local_ref', 'model', 'orig_mission_code', 'product_id/id', 'project_po', 'receipt_place', 'serial_nb', 'type', 'year']","[('name', '=', False)]",partner_id,MISSION,stock.picking.create_asset,product.asset,Create Asset Object,1002,Valid |
7 | reset_ref_by_recovery_mode,TRUE,TRUE,['name'],"[('name', '=', False)]",partner_id,MISSION,sale.order.reset_ref_by_recovery_mode,sale.order,Reset Due to Recovery,1003,Valid |
8 | -USB_replicate_po,TRUE,TRUE,"['name', 'analytic_distribution_id/id', 'partner_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'cross_docking_ok', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_qty', 'order_line/product_uom', 'order_line/price_unit', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('state','in',['approved', 'done'])]",partner_id,USB,purchase.order.usb_replicate_po,purchase.order,USB_replicate_po,2000,Valid |
9 | -USB_replicate_fo,TRUE,TRUE,"['name', 'location_requestor_id/id', 'analytic_distribution_id/id', 'partner_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_uom_qty', 'order_line/product_uom', 'order_line/price_unit', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('state','in',['manual','done','progress'])]",partner_id,USB,sale.order.usb_replicate_fo,sale.order,USB_replicate_fo,2001,Valid |
10 | -USB_replicate_ir,TRUE,TRUE,"['name', 'location_requestor_id/id', 'analytic_distribution_id/id', 'partner_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_uom_qty', 'order_line/product_uom', 'order_line/price_unit','order_line/cost_price', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('procurement_request', '=', True), ('state', 'in', ['progress','done'])]",partner_id,USB,sale.order.usb_replicate_fo,sale.order,USB_replicate_ir,2003,Valid |
11 | +USB_replicate_po,TRUE,TRUE,"['name', 'analytic_distribution_id/id', 'partner_id/id','pricelist_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'cross_docking_ok', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_qty', 'order_line/product_uom', 'order_line/price_unit', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('state','in',['approved', 'done'])]",partner_id,USB,purchase.order.usb_replicate_po,purchase.order,USB_replicate_po,2000,Valid |
12 | +USB_replicate_fo,TRUE,TRUE,"['name', 'location_requestor_id/id', 'analytic_distribution_id/id', 'partner_id/id','pricelist_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_uom_qty', 'order_line/product_uom', 'order_line/price_unit', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('state','in',['manual','done','progress'])]",partner_id,USB,sale.order.usb_replicate_fo,sale.order,USB_replicate_fo,2001,Valid |
13 | +USB_replicate_ir,TRUE,TRUE,"['name', 'location_requestor_id/id', 'analytic_distribution_id/id', 'partner_id/id','pricelist_id/id','delivery_requested_date','details','notes', 'origin', 'categ', 'order_type', 'priority', 'loan_duration', 'is_a_counterpart', 'order_line/product_id/id', 'order_line/product_id/name','order_line/id', 'order_line/name', 'order_line/product_uom_qty', 'order_line/product_uom', 'order_line/price_unit','order_line/cost_price', 'order_line/analytic_distribution_id/id','order_line/comment','order_line/have_analytic_distribution_from_header','order_line/line_number', 'order_line/nomen_manda_0/id','order_line/nomen_manda_1/id','order_line/nomen_manda_2/id','order_line/nomen_manda_3/id', 'order_line/sync_order_line_db_id', 'order_line/nomenclature_description','order_line/notes','order_line/default_name','order_line/default_code','order_line/is_line_split','order_line/date_planned','order_line/procurement_id/id']","[('procurement_request', '=', True), ('state', 'in', ['progress','done'])]",partner_id,USB,sale.order.usb_replicate_fo,sale.order,USB_replicate_ir,2003,Valid |
14 | USB_replicate_in,TRUE,TRUE,"['name','subtype','rw_force_seq','from_wkf','state','stock_journal_id/id','origin','purchase_id/id', 'sale_id/id', 'shipment_id/name','shipment_id/num_of_packs','previous_step_id/name','location_id/id','backorder_ids/id', 'backorder_ids/rw_sdref_counterpart', 'backorder_id/id','warehouse_id/id','order_category','overall_qty','change_reason','cross_docking_ok','location_dest_id/id','address_id', 'partner_type_stock_picking', 'delivered','reason_type_id/id','min_date', 'note', 'partner_id', 'move_type', 'type', 'dpo_out', 'flow_type', 'transport_order_id/id', 'direct_incoming','shipment_id/name', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/reason_type_id/id','move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_qty', 'move_lines/product_uos_qty', 'move_lines/prodlot_id/id', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/id','move_lines/location_requestor_rw/id','move_lines/location_id/id','move_lines/from_pack','move_lines/to_pack','move_lines/width','move_lines/height','move_lines/weight','move_lines/length','move_lines/pack_type','move_lines/purchase_line_id/id','move_lines/sale_line_id/id','move_lines/price_unit']","[('type', '=', 'in'),('subtype', '=', 'standard'),('state', 'in', ['assigned']),('already_replicated', '=', False),('partner_id', '!=', False)]",partner_id,USB,stock.picking.usb_replicate_in,stock.picking,USB_replicate_in,2010,Valid |
15 | USB_update_in_shipped_available,TRUE,TRUE,"['name','from_wkf','subtype','rw_force_seq','state','stock_journal_id/id','origin','purchase_id/id', 'sale_id/id', 'shipment_id/name','shipment_id/num_of_packs','previous_step_id/name','location_id/id','backorder_ids/id', 'backorder_ids/rw_sdref_counterpart', 'backorder_id/id','warehouse_id/id','order_category','overall_qty','change_reason','cross_docking_ok','location_dest_id/id','address_id', 'partner_type_stock_picking', 'delivered','reason_type_id/id','min_date', 'note', 'partner_id', 'move_type', 'type', 'dpo_out', 'flow_type', 'transport_order_id/id', 'direct_incoming','shipment_id/name', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/reason_type_id/id','move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_qty', 'move_lines/product_uos_qty', 'move_lines/prodlot_id/id', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/id','move_lines/location_requestor_rw/id','move_lines/location_id/id','move_lines/from_pack','move_lines/to_pack','move_lines/width','move_lines/height','move_lines/weight','move_lines/length','move_lines/pack_type','move_lines/purchase_line_id/id','move_lines/sale_line_id/id','move_lines/price_unit']","[('type', '=', 'in'),('subtype', '=', 'standard'),('state', 'in', ['shipped']),('partner_id', '!=', False),('already_replicated', '=', False)]",partner_id,USB,stock.picking.usb_update_in_shipped_available,stock.picking,USB_update_in_shipped_available,2011,Valid |
16 | USB_cancel_in,TRUE,TRUE,"['name','subtype','origin']","[('type', '=', 'in'),('subtype', '=', 'standard'),('state', 'in', ['cancel']),('partner_id', '!=', False)]",partner_id,USB,stock.picking.usb_cancel_in,stock.picking,USB_cancel_in,2012,Valid |
17 | |
18 | === modified file 'msf_sync_data_server/data/sync_server.sync_rule.csv' |
19 | --- msf_sync_data_server/data/sync_server.sync_rule.csv 2015-05-29 11:54:39 +0000 |
20 | +++ msf_sync_data_server/data/sync_server.sync_rule.csv 2015-05-29 11:56:50 +0000 |
21 | @@ -124,8 +124,8 @@ |
22 | msf_sync_data_server.record_rules,TRUE,TRUE,TRUE,bidirectional,Down,[],"['domain_force', 'global', 'groups/id', 'model_id/id', 'name', 'perm_create', 'perm_read', 'perm_unlink', 'perm_write']",OC,ir.rule,,Record Rules,Valid,,702 |
23 | msf_sync_data_server.access_rights_header,TRUE,TRUE,TRUE,bidirectional,Down,[],"['active', 'comment', 'domain_id/id', 'domain_text', 'family_model_ids/id', 'group_ids/id', 'instance_level', 'model_id/id', 'model_name', 'name', 'status']",OC,msf_field_access_rights.field_access_rule,,Field Access Rules,Valid,,703 |
24 | msf_sync_data_server.access_rights_lines,TRUE,TRUE,TRUE,bidirectional,Down,[],"['field/id', 'field_access_rule/id', 'field_access_rule_model_id', 'field_name', 'value_not_synchronized_on_create', 'value_not_synchronized_on_write', 'write_access']",OC,msf_field_access_rights.field_access_rule_line,,Field Access Rule Lines,Valid,,704 |
25 | -msf_sync_data_server.button_access_rules,TRUE,TRUE,FALSE,bidirectional,Down,[],"['active', 'comment', 'group_ids/id', 'group_names', 'label', 'model_id/id', 'name', 'type', 'view_id/id']",OC,msf_button_access_rights.button_access_rule,,Button Access Rules,Valid,,705 |
26 | -msf_sync_data_server.window_actions,TRUE,TRUE,FALSE,bidirectional,Down,"[('res_model','!=','audittrail.log.line')]",['groups_id/id'],OC,ir.actions.act_window,,Window Action groups,Valid,,706 |
27 | +msf_sync_data_server.button_access_rules,TRUE,TRUE,FALSE,bidirectional,Down,"[('is_remote_wh', '=', False)]","['active', 'comment', 'group_ids/id', 'group_names', 'label', 'model_id/id', 'name', 'type', 'view_id/id']",OC,msf_button_access_rights.button_access_rule,,Button Access Rules,Valid,,705 |
28 | +msf_sync_data_server.window_actions,TRUE,TRUE,FALSE,bidirectional,Down,"[('res_model','!=','audittrail.log.line'), ('is_remote_wh', '=', False)]",['groups_id/id'],OC,ir.actions.act_window,,Window Action groups,Valid,,706 |
29 | msf_sync_data.sync_monitor,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,"[('status', '=', 'ok')]","['instance_id/id', 'nb_msg_pull', 'nb_data_pull', 'nb_msg_push', 'nb_data_push', 'nb_msg_not_run', 'nb_data_not_run', 'start', 'end', 'destination_instance_id/id']",OC,sync.monitor,destination_instance_id,Sync Monitor,Valid,,720 |
30 | msf_usb_sync_data_server.cp_res_groups,TRUE,TRUE,TRUE,cp_to_rw,Bidirectional,[],"['comment', 'from_file_import_res_groups', 'name', 'visible_res_groups', 'is_an_admin_profile']",USB,res.groups,,[CONFIG] Group,Valid,,1000 |
31 | msf_usb_sync_data_server.cp_res_users,TRUE,TRUE,FALSE,cp_to_rw,Bidirectional,"[('active', '=', True)]","['email', 'login', 'name', 'user_email']",USB,res.users,,[CONFIG] Res Users,Valid,,1001 |
32 | |
33 | === modified file 'sync_remote_warehouse/wizard/setup_remote_warehouse.py' |
34 | --- sync_remote_warehouse/wizard/setup_remote_warehouse.py 2015-03-03 14:55:29 +0000 |
35 | +++ sync_remote_warehouse/wizard/setup_remote_warehouse.py 2015-05-29 11:56:50 +0000 |
36 | @@ -204,7 +204,8 @@ |
37 | |
38 | def _revert_central_platform(self, cr, uid, entity_id, context=None): |
39 | self._set_entity_type(cr, uid, entity_id, "", context=context) |
40 | - self._set_sequence_suffix(cr, uid, suffix="-RW", context=context) |
41 | + #US-208: Do not change the suffixes of the documents |
42 | + self._set_sequence_suffix(cr, uid, suffix="", context=context) |
43 | |
44 | def _get_db_dump(self, database_name): |
45 | """ Makes a dump of database_name and returns the base64 SQL """ |
46 | |
47 | === modified file 'sync_so/so_po_common.py' |
48 | --- sync_so/so_po_common.py 2015-04-27 07:55:06 +0000 |
49 | +++ sync_so/so_po_common.py 2015-05-29 11:56:50 +0000 |
50 | @@ -231,8 +231,9 @@ |
51 | |
52 | partner_id = self.get_partner_id(cr, uid, source, context) |
53 | address_id = self.get_partner_address_id(cr, uid, partner_id, context) |
54 | - price_list = self.get_price_list_id(cr, uid, partner_id, context) |
55 | location_id = self.get_location(cr, uid, partner_id, context) |
56 | + # just roll back what has been modified --- NO MODIF HERE! |
57 | + price_list = self.get_price_list_id(cr, uid, partner_id, context) |
58 | |
59 | header_result['partner_ref'] = source + "." + header_info.get('name') |
60 | header_result['partner_id'] = partner_id |
61 | @@ -307,7 +308,10 @@ |
62 | |
63 | partner_id = self.get_partner_id(cr, uid, source, context) |
64 | address_id = self.get_partner_address_id(cr, uid, partner_id, context) |
65 | - price_list = self.get_price_list_id(cr, uid, partner_id, context) |
66 | + if 'pricelist_id' in header_info: |
67 | + price_list = header_info.get('pricelist_id') |
68 | + else: |
69 | + price_list = self.get_price_list_id(cr, uid, partner_id, context) |
70 | |
71 | header_result['client_order_ref'] = source + "." + header_info.get('name') |
72 | header_result['partner_id'] = partner_id |
73 | |
74 | === modified file 'sync_so/so_po_rw.py' |
75 | --- sync_so/so_po_rw.py 2014-11-30 20:32:39 +0000 |
76 | +++ sync_so/so_po_rw.py 2015-05-29 11:56:50 +0000 |
77 | @@ -126,10 +126,18 @@ |
78 | if rec_id: |
79 | header_result['partner_id'] = rec_id |
80 | partner = self.pool.get('res.partner').browse(cr, uid, rec_id, context=context) |
81 | - if partner.property_product_pricelist_purchase: |
82 | + |
83 | + # US-208: Retrieve the pricelist: if it's provided from sync, then use it |
84 | + if 'pricelist_id' in so_dict and so_dict.get('pricelist_id', True): |
85 | + pl_xmlid = so_dict.get('pricelist_id')['id'] |
86 | + if pl_xmlid: |
87 | + header_result['pricelist_id'] = self.pool.get('product.pricelist').find_sd_ref(cr, uid, xmlid_to_sdref(pl_xmlid), context=context) |
88 | + elif partner.property_product_pricelist_purchase: |
89 | header_result['pricelist_id'] = partner.property_product_pricelist_purchase.id |
90 | + # In any case, if the code does not enter in the block above, the default pricelist_id is still used |
91 | |
92 | header_result['cross_docking_ok'] = so_dict.get('cross_docking_ok', False) |
93 | + |
94 | # check whether this FO has already been sent before! if it's the case, then just update the existing PO, and not creating a new one |
95 | partner_ref = source + "." + sync_values.name |
96 | existing_ids = self.search(cr, uid, [('name', '=', po_name), ('partner_ref', '=', partner_ref), ('state', '=', 'rw')], context=context) |
97 | @@ -155,7 +163,6 @@ |
98 | line.update({'order_id': po_id}) |
99 | so_po_common.create_rw_xml_for_line(cr, uid, line_obj,line, context =context) |
100 | |
101 | - name = self.browse(cr, uid, po_id, context=context).name |
102 | message = "The PO " + po_name + " has been well replicated at " + cr.dbname |
103 | self._logger.info(message) |
104 | return message |
105 | |
106 | === modified file 'sync_so/specific_xml_id.py' |
107 | --- sync_so/specific_xml_id.py 2015-05-28 11:41:07 +0000 |
108 | +++ sync_so/specific_xml_id.py 2015-05-29 11:56:50 +0000 |
109 | @@ -40,6 +40,7 @@ |
110 | |
111 | account_journal() |
112 | |
113 | + |
114 | class ir_actions_act_window(osv.osv): |
115 | _inherit = 'ir.actions.act_window' |
116 | |
117 | @@ -51,8 +52,38 @@ |
118 | origin_xmlid = model_data_obj.read(cr, uid, sdref_ids[0], ['module', 'name']) |
119 | return get_valid_xml_name(origin_xmlid['module'], origin_xmlid['name']) |
120 | |
121 | + def write(self, cr, uid, ids, vals, context=None): |
122 | + if context is None: |
123 | + context = {} |
124 | + if context.get('sync_update_execution') and 'groups_id/id' in context.get('fields', []) and 'groups_id' not in vals: |
125 | + vals['groups_id'] = [(6, 0, [])] |
126 | + return super(ir_actions_act_window, self).write(cr, uid, ids, vals, context) |
127 | + |
128 | + def _get_is_remote_wh(self, cr, uid, ids, field_name, args, context=None): |
129 | + return {}.fromkeys(ids, False) |
130 | + |
131 | + def _search_is_remote_wh(self, cr, uid, obj, name, args, context=None): |
132 | + if not args: |
133 | + return [] |
134 | + rarg = [] |
135 | + for arg in args: |
136 | + if arg[1] != '=': |
137 | + raise osv.except_osv('Error', 'Filter on is_remote_wh not implemented') |
138 | + model_data_obj = self.pool.get('ir.model.data') |
139 | + mod_ids = model_data_obj.search(cr, uid, [('model', '=', obj._name), ('module', '=', 'sync_remote_warehouse')]) |
140 | + ids = [] |
141 | + for m in model_data_obj.read(cr, uid, mod_ids, ['res_id']): |
142 | + ids.append(m['res_id']) |
143 | + value = arg[2] not in (False, 'f', 'False') |
144 | + rarg.append(('id', value and 'in' or 'not in', ids)) |
145 | + return rarg |
146 | + |
147 | + _columns = { |
148 | + 'is_remote_wh': fields.function(_get_is_remote_wh, type='boolean', string="From RW module", fnct_search=_search_is_remote_wh, method=True), |
149 | + } |
150 | ir_actions_act_window() |
151 | |
152 | + |
153 | class bank_statement(osv.osv): |
154 | |
155 | _inherit = 'account.bank.statement' |
156 | @@ -841,6 +872,29 @@ |
157 | view_xml_id = self.pool.get('ir.ui.view').get_xml_id(cr, 1, [bar.view_id.id]) |
158 | return get_valid_xml_name('BAR', view_xml_id[bar.view_id.id], bar.name) |
159 | |
160 | + def _get_is_remote_wh(self, cr, uid, ids, field_name, args, context=None): |
161 | + return {}.fromkeys(ids, False) |
162 | + |
163 | + def _search_is_remote_wh(self, cr, uid, obj, name, args, context=None): |
164 | + if not args: |
165 | + return [] |
166 | + rarg = [] |
167 | + for arg in args: |
168 | + if arg[1] != '=': |
169 | + raise osv.except_osv('Error', 'Filter on is_remote_wh not implemented') |
170 | + model_data_obj = self.pool.get('ir.model.data') |
171 | + mod_ids = model_data_obj.search(cr, uid, [('model', '=', obj._name), ('name', '=like', 'BAR_sync_remote_warehouse%')]) |
172 | + ids = [] |
173 | + for m in model_data_obj.read(cr, uid, mod_ids, ['res_id']): |
174 | + ids.append(m['res_id']) |
175 | + value = arg[2] not in (False, 'f', 'False') |
176 | + rarg.append(('id', value and 'in' or 'not in', ids)) |
177 | + return rarg |
178 | + |
179 | + _columns = { |
180 | + 'is_remote_wh': fields.function(_get_is_remote_wh, type='boolean', string="From RW module", fnct_search=_search_is_remote_wh, method=True), |
181 | + } |
182 | + |
183 | button_access_rule() |
184 | |
185 | class hr_employee(osv.osv): |