228
def _get_do_not_sync(self, cr, uid, ids, field_name, args, context=None):
234
current_company_p_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.partner_id.id
236
for pick in self.browse(cr, uid, ids, context=context):
238
if pick.partner_id.id == current_company_p_id:
243
def _src_do_not_sync(self, cr, uid, obj, name, args, context=None):
245
Returns picking ticket that do not synched because the partner of the
246
picking is the partner of the current company.
249
curr_partner_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.partner_id.id
256
eq_false = arg[1] == '=' and arg[2] in (False, 'f', 'false', 'False', 0)
257
neq_true = arg[1] in ('!=', '<>') and arg[2] in (True, 't', 'true', 'True', 1)
258
eq_true = arg[1] == '=' and arg[2] in (True, 't', 'true', 'True', 1)
259
neq_false = arg[1] in ('!=', '<>') and arg[2] in (False, 'f', 'false', 'False', 0)
261
if arg[0] == 'do_not_sync' and (eq_false or neq_true):
262
res.append(('partner_id', '!=', curr_partner_id))
263
elif arg[0] == 'do_not_sync' and (eq_true or neq_false):
264
res.append(('partner_id', '=', curr_partner_id))
229
270
'state': fields.selection([
230
271
('draft', 'Draft'),
265
306
store={'stock.move': (_get_dpo_picking_ids, ['sync_dpo', 'dpo_line_id', 'picking_id'], 10,),
266
307
'stock.picking': (lambda self, cr, uid, ids, c={}: ids, ['move_lines'], 10)}),
267
308
'previous_chained_pick_id': fields.many2one('stock.picking', string='Previous chained picking', ondelete='set null', readonly=True),
309
'do_not_sync': fields.function(
311
fnct_search=_src_do_not_sync,
314
string='Do not sync.',
270
319
_defaults = {'from_yml_test': lambda *a: False,