Exemplo n.º 1
0
    def _name_search(self,
                     name,
                     args=None,
                     operator='ilike',
                     limit=100,
                     name_get_uid=None):
        args = args or []
        if self.env.context.get('country_id'):
            args = expression.AND([
                args, [('country_id', '=', self.env.context.get('country_id'))]
            ])

        if operator == 'ilike' and not (name or '').strip():
            first_domain = []
            domain = []
        else:
            first_domain = [('code', '=ilike', name)]
            domain = [('name', operator, name)]

        first_state_ids = self._search(
            expression.AND([first_domain, args]),
            limit=limit,
            access_rights_uid=name_get_uid) if first_domain else []
        state_ids = first_state_ids + [
            state_id
            for state_id in self._search(expression.AND([domain, args]),
                                         limit=limit,
                                         access_rights_uid=name_get_uid)
            if not state_id in first_state_ids
        ]
        return self.browse(state_ids).name_get()
Exemplo n.º 2
0
 def _name_search(self,
                  name,
                  args=None,
                  operator='ilike',
                  limit=100,
                  name_get_uid=None):
     if operator not in ('ilike', 'like', '=', '=like', '=ilike'):
         return super(AccountAnalyticAccount,
                      self)._name_search(name,
                                         args,
                                         operator,
                                         limit,
                                         name_get_uid=name_get_uid)
     args = args or []
     if operator == 'ilike' and not (name or '').strip():
         domain = []
     else:
         # search by partner separately because auto_join field can break searches
         partner_domain = [('partner_id.name', operator, name)]
         ids_partner = self._search(expression.AND([partner_domain, args]),
                                    limit=limit,
                                    access_rights_uid=name_get_uid)
         domain = [
             '|', '|', ('code', operator, name), ('name', operator, name),
             ('id', 'in', ids_partner)
         ]
     analytic_account_ids = self._search(expression.AND([domain, args]),
                                         limit=limit,
                                         access_rights_uid=name_get_uid)
     return self.browse(analytic_account_ids).name_get()
Exemplo n.º 3
0
 def render_latest_posts(self,
                         template,
                         domain,
                         limit=None,
                         order='published_date desc'):
     dom = expression.AND([[('website_published', '=', True),
                            ('post_date', '<=', fields.Datetime.now())],
                           request.website.website_domain()])
     if domain:
         dom = expression.AND([dom, domain])
     posts = request.env['blog.post'].search(dom, limit=limit, order=order)
     return request.website.viewref(template).render({'posts': posts})
Exemplo n.º 4
0
    def _gather(self, product_id, location_id, lot_id=None, package_id=None, owner_id=None, strict=False):
        removal_strategy = self._get_removal_strategy(product_id, location_id)
        removal_strategy_order = self._get_removal_strategy_order(removal_strategy)
        domain = [
            ('product_id', '=', product_id.id),
        ]
        if not strict:
            if lot_id:
                domain = expression.AND([['|', ('lot_id', '=', lot_id.id), ('lot_id', '=', False)], domain])
            if package_id:
                domain = expression.AND([[('package_id', '=', package_id.id)], domain])
            if owner_id:
                domain = expression.AND([[('owner_id', '=', owner_id.id)], domain])
            domain = expression.AND([[('location_id', 'child_of', location_id.id)], domain])
        else:
            domain = expression.AND([['|', ('lot_id', '=', lot_id.id), ('lot_id', '=', False)] if lot_id else [('lot_id', '=', False)], domain])
            domain = expression.AND([[('package_id', '=', package_id and package_id.id or False)], domain])
            domain = expression.AND([[('owner_id', '=', owner_id and owner_id.id or False)], domain])
            domain = expression.AND([[('location_id', '=', location_id.id)], domain])

        # Copy code of _search for special NULLS FIRST/LAST order
        self.sudo(self._uid).check_access_rights('read')
        query = self._where_calc(domain)
        self._apply_ir_rules(query, 'read')
        from_clause, where_clause, where_clause_params = query.get_sql()
        where_str = where_clause and (" WHERE %s" % where_clause) or ''
        query_str = 'SELECT "%s".id FROM ' % self._table + from_clause + where_str + " ORDER BY "+ removal_strategy_order
        self._cr.execute(query_str, where_clause_params)
        res = self._cr.fetchall()
        # No uniquify list necessary as auto_join is not applied anyways...
        quants = self.browse([x[0] for x in res])
        quants = quants.sorted(lambda q: not q.lot_id)
        return quants
Exemplo n.º 5
0
 def _get_assets_domain_for_already_processed_css(self, assets):
     res = super(AssetsBundleMultiWebsite,
                 self)._get_assets_domain_for_already_processed_css(assets)
     current_website = self.env['website'].get_current_website(
         fallback=False)
     res = expression.AND([res, current_website.website_domain()])
     return res
Exemplo n.º 6
0
 def _name_search(self,
                  name,
                  args=None,
                  operator='ilike',
                  limit=100,
                  name_get_uid=None):
     # TDE FIXME: currently overriding the domain; however as it includes a
     # search on a m2o and one on a m2m, probably this will quickly become
     # difficult to compute - check if performance optimization is required
     if name and operator in ('=', 'ilike', '=ilike', 'like', '=like'):
         args = args or []
         domain = [
             '|', ('attribute_id', operator, name),
             ('value_ids', operator, name)
         ]
         attribute_ids = self._search(expression.AND([domain, args]),
                                      limit=limit,
                                      access_rights_uid=name_get_uid)
         return self.browse(attribute_ids).name_get()
     return super(ProductTemplateAttributeLine,
                  self)._name_search(name=name,
                                     args=args,
                                     operator=operator,
                                     limit=limit,
                                     name_get_uid=name_get_uid)
Exemplo n.º 7
0
    def _domain_move_lines_for_reconciliation(self,
                                              st_line,
                                              aml_accounts,
                                              partner_id,
                                              excluded_ids=None,
                                              search_str=False):
        def to_int(val):
            try:
                return int(val)
            except (ValueError, TypeError):
                return None

        domain = super()._domain_move_lines_for_reconciliation(
            st_line,
            aml_accounts,
            partner_id,
            excluded_ids=excluded_ids,
            search_str=search_str)
        acc_props = (
            "property_stock_account_input",
            "property_stock_account_output",
            "property_stock_account_input_categ_id",
            "property_stock_account_output_categ_id",
        )
        acc_ids = [
            (acc["value_reference"] or "").split(",")[-1]
            for acc in self.env["ir.property"].sudo().search([(
                "name", "in", acc_props), ("value_reference", "!=",
                                           False)]).read(["value_reference"])
            if to_int((acc["value_reference"] or "").split(",")[-1])
        ]
        if acc_ids:
            domain = expression.AND(
                [domain, [("account_id.id", "not in", acc_ids)]])
        return domain
Exemplo n.º 8
0
 def _get_moves_to_assign_domain(self, company_id):
     moves_domain = [
         ('state', 'in', ['confirmed', 'partially_available']),
         ('product_uom_qty', '!=', 0.0)
     ]
     if company_id:
         moves_domain = expression.AND([[('company_id', '=', company_id)], moves_domain])
     return moves_domain
Exemplo n.º 9
0
 def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
     """ search full name and barcode """
     args = args or []
     if operator == 'ilike' and not (name or '').strip():
         domain = []
     else:
         domain = ['|', ('barcode', operator, name), ('complete_name', operator, name)]
     location_ids = self._search(expression.AND([domain, args]), limit=limit, access_rights_uid=name_get_uid)
     return self.browse(location_ids).name_get()
Exemplo n.º 10
0
 def _name_search(self,
                  name,
                  args=None,
                  operator='ilike',
                  limit=100,
                  name_get_uid=None):
     domain = args or []
     cars = self._search(expression.AND(
         [domain, [('name', operator, name)]]),
                         limit=limit,
                         access_rights_uid=name_get_uid)
     cars += self._search(expression.AND(
         [domain, [('driver_id.name', operator, name)]]),
                          limit=limit,
                          access_rights_uid=name_get_uid)
     rec = self._search([('id', 'in', cars)],
                        limit=limit,
                        access_rights_uid=name_get_uid)
     return self.browse(rec).name_get()
Exemplo n.º 11
0
 def get_website_translations(self, lang, mods=None):
     Modules = request.env['ir.module.module'].sudo()
     IrHttp = request.env['ir.http'].sudo()
     domain = IrHttp._get_translation_frontend_modules_domain()
     modules = Modules.search(
         expression.AND([domain, [('state', '=', 'installed')]])
     ).mapped('name')
     if mods:
         modules += mods
     return WebClient().translations(mods=modules, lang=lang)
Exemplo n.º 12
0
    def _get_inheriting_views_arch_domain(self, view_id, model):
        domain = super(View,
                       self)._get_inheriting_views_arch_domain(view_id, model)
        current_website = self._get_inheriting_views_arch_website(view_id)
        website_views_domain = current_website.website_domain()
        # when rendering for the website we have to include inactive views
        # we will prefer inactive website-specific views over active generic ones
        if current_website:
            domain = [leaf for leaf in domain if 'active' not in leaf]

        return expression.AND([website_views_domain, domain])
Exemplo n.º 13
0
 def _search_rule(self, route_ids, product_id, warehouse_id, domain):
     """ First find a rule among the ones defined on the procurement
     group, then try on the routes defined for the product, finally fallback
     on the default behavior
     """
     if warehouse_id:
         domain = expression.AND([['|', ('warehouse_id', '=', warehouse_id.id), ('warehouse_id', '=', False)], domain])
     Rule = self.env['stock.rule']
     res = self.env['stock.rule']
     if route_ids:
         res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]), order='route_sequence, sequence', limit=1)
     if not res:
         product_routes = product_id.route_ids | product_id.categ_id.total_route_ids
         if product_routes:
             res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]), order='route_sequence, sequence', limit=1)
     if not res and warehouse_id:
         warehouse_routes = warehouse_id.route_ids
         if warehouse_routes:
             res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]), order='route_sequence, sequence', limit=1)
     return res
Exemplo n.º 14
0
    def _compute_domain(self, model_name, mode="read"):
        if mode not in self._MODES:
            raise ValueError('Invalid mode: %r' % (mode, ))

        if self._uid == SUPERUSER_ID:
            return None

        query = """ SELECT r.id FROM ir_rule r JOIN ir_model m ON (r.model_id=m.id)
                    WHERE m.model=%s AND r.active AND r.perm_{mode}
                    AND (r.id IN (SELECT rule_group_id FROM rule_group_rel rg
                                  JOIN res_groups_users_rel gu ON (rg.group_id=gu.gid)
                                  WHERE gu.uid=%s)
                         OR r.global)
                """.format(mode=mode)
        self._cr.execute(query, (model_name, self._uid))
        rule_ids = [row[0] for row in self._cr.fetchall()]
        if not rule_ids:
            return []

        # browse user and rules as SUPERUSER_ID to avoid access errors!
        eval_context = self._eval_context()
        user_groups = self.env.user.groups_id
        global_domains = []  # list of domains
        group_domains = []  # list of domains
        for rule in self.browse(rule_ids).sudo():
            # evaluate the domain for the current user
            dom = safe_eval(rule.domain_force,
                            eval_context) if rule.domain_force else []
            dom = expression.normalize_domain(dom)
            if not rule.groups:
                global_domains.append(dom)
            elif rule.groups & user_groups:
                group_domains.append(dom)

        # combine global domains and group domains
        if not group_domains:
            return expression.AND(global_domains)
        return expression.AND(global_domains + [expression.OR(group_domains)])
Exemplo n.º 15
0
    def get_mention_suggestions(self, search, limit=8):
        """ Return 'limit'-first partners' id, name and email such that the name or email matches a
            'search' string. Prioritize users, and then extend the research to all partners. """
        search_dom = expression.OR([[('name', 'ilike', search)],
                                    [('email', 'ilike', search)]])
        search_dom = expression.AND([[('active', '=', True)], search_dom])
        fields = ['id', 'name', 'email']

        # Search users
        domain = expression.AND([[('user_ids.id', '!=', False),
                                  ('user_ids.active', '=', True)], search_dom])
        users = self.search_read(domain, fields, limit=limit)

        # Search partners if less than 'limit' users found
        partners = []
        if len(users) < limit:
            partners = self.search_read(search_dom, fields, limit=limit)
            # Remove duplicates
            partners = [
                p for p in partners
                if not len([u for u in users if u['id'] == p['id']])
            ]

        return [users, partners]
Exemplo n.º 16
0
    def portal_message_fetch(self, res_model, res_id, domain=False, limit=10, offset=0, **kw):
        if not domain:
            domain = []
        # Only search into website_message_ids, so apply the same domain to perform only one search
        # extract domain from the 'website_message_ids' field
        field_domain = request.env[res_model]._fields['website_message_ids'].domain
        if callable(field_domain):
            field_domain = field_domain(request.env[res_model])
        domain = expression.AND([domain, field_domain, [('res_id', '=', res_id)]])

        # Check access
        Message = request.env['mail.message']
        if kw.get('token'):
            access_as_sudo = _has_token_access(res_model, res_id, token=kw.get('token'))
            if not access_as_sudo:  # if token is not correct, raise Forbidden
                raise Forbidden()
            # Non-employee see only messages with not internal subtype (aka, no internal logs)
            if not request.env['res.users'].has_group('base.group_user'):
                domain = expression.AND([Message._non_employee_message_domain(), domain])
            Message = request.env['mail.message'].sudo()
        return {
            'messages': Message.search(domain, limit=limit, offset=offset).portal_message_format(),
            'message_count': Message.search_count(domain)
        }
Exemplo n.º 17
0
 def _name_search(self,
                  name,
                  args=None,
                  operator='ilike',
                  limit=100,
                  name_get_uid=None):
     args = args or []
     domain = []
     if name:
         domain = [
             '|', ('name', operator, name), ('reference', operator, name)
         ]
     purchase_bills_union_ids = self._search(expression.AND([domain, args]),
                                             limit=limit,
                                             access_rights_uid=name_get_uid)
     return self.browse(purchase_bills_union_ids).name_get()
Exemplo n.º 18
0
    def _compute_debit_credit_balance(self):
        Curr = self.env['res.currency']
        analytic_line_obj = self.env['account.analytic.line']
        domain = [('account_id', 'in', self.ids)]
        if self._context.get('from_date', False):
            domain.append(('date', '>=', self._context['from_date']))
        if self._context.get('to_date', False):
            domain.append(('date', '<=', self._context['to_date']))
        if self._context.get('tag_ids'):
            tag_domain = expression.OR([[('tag_ids', 'in', [tag])]
                                        for tag in self._context['tag_ids']])
            domain = expression.AND([domain, tag_domain])
        if self._context.get('company_ids'):
            domain.append(('company_id', 'in', self._context['company_ids']))

        user_currency = self.env.user.company_id.currency_id
        credit_groups = analytic_line_obj.read_group(
            domain=domain + [('amount', '>=', 0.0)],
            fields=['account_id', 'currency_id', 'amount'],
            groupby=['account_id', 'currency_id'],
            lazy=False,
        )
        data_credit = defaultdict(float)
        for l in credit_groups:
            data_credit[l['account_id'][0]] += Curr.browse(
                l['currency_id'][0])._convert(l['amount'], user_currency,
                                              self.env.user.company_id,
                                              fields.Date.today())

        debit_groups = analytic_line_obj.read_group(
            domain=domain + [('amount', '<', 0.0)],
            fields=['account_id', 'currency_id', 'amount'],
            groupby=['account_id', 'currency_id'],
            lazy=False,
        )
        data_debit = defaultdict(float)
        for l in debit_groups:
            data_debit[l['account_id'][0]] += Curr.browse(
                l['currency_id'][0])._convert(l['amount'], user_currency,
                                              self.env.user.company_id,
                                              fields.Date.today())

        for account in self:
            account.debit = abs(data_debit.get(account.id, 0.0))
            account.credit = data_credit.get(account.id, 0.0)
            account.balance = account.credit - account.debit
Exemplo n.º 19
0
 def _get_rule(self, product_id, location_id, values):
     """ Find a pull rule for the location_id, fallback on the parent
     locations if it could not be found.
     """
     result = False
     location = location_id
     while (not result) and location:
         domain = ['&', ('location_id', '=', location.id), ('action', '!=', 'push')]
         # In case the method is called by the superuser, we need to restrict the rules to the
         # ones of the company. This is not useful as a regular user since there is a record
         # rule to filter out the rules based on the company.
         if self.env.user._is_superuser() and values.get('company_id'):
             domain_company = ['|', ('company_id', '=', False), ('company_id', 'child_of', values['company_id'].ids)]
             domain = expression.AND([domain, domain_company])
         result = self._search_rule(values.get('route_ids', False), product_id, values.get('warehouse_id', False), domain)
         location = location.location_id
     return result
Exemplo n.º 20
0
 def _name_search(self,
                  name,
                  args=None,
                  operator='ilike',
                  limit=100,
                  name_get_uid=None):
     args = args or []
     if name:
         action_ids = self._search(expression.AND([[('action_id', operator,
                                                     name)], args]),
                                   limit=limit,
                                   access_rights_uid=name_get_uid)
         return self.browse(action_ids).name_get()
     return super(IrActionsTodo,
                  self)._name_search(name,
                                     args=args,
                                     operator=operator,
                                     limit=limit,
                                     name_get_uid=name_get_uid)
Exemplo n.º 21
0
    def _search(self,
                args,
                offset=0,
                limit=None,
                order=None,
                count=False,
                access_rights_uid=None):
        """ Override that adds specific access rights of mail.message, to restrict
        messages to published messages for public users. """
        if self.user_has_groups('base.group_public'):
            args = expression.AND([[('website_published', '=', True)],
                                   list(args)])

        return super(MailMessage,
                     self)._search(args,
                                   offset=offset,
                                   limit=limit,
                                   order=order,
                                   count=count,
                                   access_rights_uid=access_rights_uid)
Exemplo n.º 22
0
 def action_see_days_allocated(self):
     self.ensure_one()
     action = self.env.ref(
         'hr_holidays.hr_leave_allocation_action_all').read()[0]
     domain = [
         ('holiday_status_id', 'in', self.ids),
         ('holiday_type', '!=', 'employee'),
     ]
     domain2 = [
         '|',
         ('date_from', '>=',
          fields.Datetime.to_string(datetime.datetime.now().replace(
              month=1, day=1, hour=0, minute=0, second=0, microsecond=0))),
         ('date_from', '=', False),
     ]
     action['domain'] = expression.AND([domain, domain2])
     action['context'] = {
         'default_holiday_type': 'department',
         'default_holiday_status_id': self.ids[0],
     }
     return action
Exemplo n.º 23
0
 def _change_model_id(self):
     """Force domain for the `field_id` and `field_date_id` fields"""
     if not self.model_id:
         return {
             'domain': {
                 'field_id': expression.FALSE_DOMAIN,
                 'field_date_id': expression.FALSE_DOMAIN
             }
         }
     model_fields_domain = [('store', '=', True), '|',
                            ('model_id', '=', self.model_id.id),
                            ('model_id', 'in',
                             self.model_id.inherited_model_ids.ids)]
     model_date_fields_domain = expression.AND([[
         ('ttype', 'in', ('date', 'datetime'))
     ], model_fields_domain])
     return {
         'domain': {
             'field_id': model_fields_domain,
             'field_date_id': model_date_fields_domain
         }
     }
Exemplo n.º 24
0
 def _compute_group_days_allocation(self):
     domain = [
         ('holiday_status_id', 'in', self.ids),
         ('holiday_type', '!=', 'employee'),
         ('state', '=', 'validate'),
     ]
     domain2 = [
         '|',
         ('date_from', '>=',
          fields.Datetime.to_string(datetime.datetime.now().replace(
              month=1, day=1, hour=0, minute=0, second=0, microsecond=0))),
         ('date_from', '=', False),
     ]
     grouped_res = self.env['hr.leave.allocation'].read_group(
         expression.AND([domain, domain2]),
         ['holiday_status_id', 'number_of_days'],
         ['holiday_status_id'],
     )
     grouped_dict = dict(
         (data['holiday_status_id'][0], data['number_of_days'])
         for data in grouped_res)
     for allocation in self:
         allocation.group_days_allocation = grouped_dict.get(
             allocation.id, 0)
Exemplo n.º 25
0
    def portal_order_page(self,
                          order_id,
                          report_type=None,
                          access_token=None,
                          message=False,
                          download=False,
                          **kw):
        try:
            order_sudo = self._document_check_access('sale.order',
                                                     order_id,
                                                     access_token=access_token)
        except (AccessError, MissingError):
            return request.redirect('/my')

        if report_type in ('html', 'pdf', 'text'):
            return self._show_report(model=order_sudo,
                                     report_type=report_type,
                                     report_ref='sale.action_report_saleorder',
                                     download=download)

        # use sudo to allow accessing/viewing orders for public user
        # only if he knows the private token
        # Log only once a day
        if order_sudo:
            now = fields.Date.today().isoformat()
            session_obj_date = request.session.get('view_quote_%s' %
                                                   order_sudo.id)
            if isinstance(session_obj_date, date):
                session_obj_date = session_obj_date.isoformat()
            if session_obj_date != now and request.env.user.share and access_token:
                request.session['view_quote_%s' % order_sudo.id] = now
                body = _('Quotation viewed by customer')
                _message_post_helper(
                    res_model='sale.order',
                    res_id=order_sudo.id,
                    message=body,
                    token=order_sudo.access_token,
                    message_type='notification',
                    subtype="mail.mt_note",
                    partner_ids=order_sudo.user_id.sudo().partner_id.ids)

        values = {
            'sale_order': order_sudo,
            'message': message,
            'token': access_token,
            'return_url': '/shop/payment/validate',
            'bootstrap_formatting': True,
            'partner_id': order_sudo.partner_id.id,
            'report_type': 'html',
        }
        if order_sudo.company_id:
            values['res_company'] = order_sudo.company_id

        if order_sudo.has_to_be_paid():
            domain = expression.AND(
                [[
                    '&', ('website_published', '=', True),
                    ('company_id', '=', order_sudo.company_id.id)
                ],
                 [
                     '|', ('specific_countries', '=', False),
                     ('country_ids', 'in',
                      [order_sudo.partner_id.country_id.id])
                 ]])
            acquirers = request.env['payment.acquirer'].sudo().search(domain)

            values['acquirers'] = acquirers.filtered(lambda acq: (
                acq.payment_flow == 'form' and acq.view_template_id) or (
                    acq.payment_flow == 's2s' and acq.
                    registration_view_template_id))
            values['pms'] = request.env['payment.token'].search([
                ('partner_id', '=', order_sudo.partner_id.id)
            ])

        if order_sudo.state in ('draft', 'sent', 'cancel'):
            history = request.session.get('my_quotations_history', [])
        else:
            history = request.session.get('my_orders_history', [])
        values.update(get_records_pager(history, order_sudo))

        return request.render('sale.sale_order_portal_template', values)
Exemplo n.º 26
0
    def open_action(self):
        """return action based on type for related journals"""
        action_name = self._context.get('action_name', False)
        if not action_name:
            if self.type == 'bank':
                action_name = 'action_bank_statement_tree'
            elif self.type == 'cash':
                action_name = 'action_view_bank_statement_tree'
            elif self.type == 'sale':
                action_name = 'action_invoice_tree1'
                use_domain = expression.AND([
                    self.env.context.get('use_domain', []),
                    [('journal_id', '=', self.id)]
                ])
                self = self.with_context(use_domain=use_domain)
            elif self.type == 'purchase':
                action_name = 'action_vendor_bill_template'
                use_domain = expression.AND([
                    self.env.context.get('use_domain', []),
                    [('journal_id', '=', self.id)]
                ])
                self = self.with_context(use_domain=use_domain)
            else:
                action_name = 'action_move_journal_line'

        _journal_invoice_type_map = {
            ('sale', None): 'out_invoice',
            ('purchase', None): 'in_invoice',
            ('sale', 'refund'): 'out_refund',
            ('purchase', 'refund'): 'in_refund',
            ('bank', None): 'bank',
            ('cash', None): 'cash',
            ('general', None): 'general',
        }
        invoice_type = _journal_invoice_type_map[(
            self.type, self._context.get('invoice_type'))]

        ctx = self._context.copy()
        ctx.pop('group_by', None)
        ctx.update({
            'journal_type': self.type,
            'default_journal_id': self.id,
            'default_type': invoice_type,
            'type': invoice_type
        })

        [action] = self.env.ref('account.%s' % action_name).read()
        if not self.env.context.get('use_domain'):
            ctx['search_default_journal_id'] = self.id
        action['context'] = ctx
        action['domain'] = self._context.get('use_domain', [])
        account_invoice_filter = self.env.ref(
            'account.view_account_invoice_filter', False)
        if action_name in [
                'action_invoice_tree1', 'action_vendor_bill_template'
        ]:
            action[
                'search_view_id'] = account_invoice_filter and account_invoice_filter.id or False
        if action_name in [
                'action_bank_statement_tree', 'action_view_bank_statement_tree'
        ]:
            action['views'] = False
            action['view_id'] = False
        if self.type == 'purchase':
            new_help = self.env['account.invoice'].with_context(
                ctx).complete_empty_list_help()
            action.update({'help': (action.get('help') or '') + new_help})
        return action
Exemplo n.º 27
0
 def _get_moves_to_assign_domain(self, company_id):
     domain = super(ProcurementGroup, self)._get_moves_to_assign_domain(company_id)
     domain = expression.AND([domain, [('production_id', '=', False)]])
     return domain
Exemplo n.º 28
0
 def _non_employee_message_domain(self):
     domain = super(MailMessage, self)._non_employee_message_domain()
     return expression.AND([domain, [('website_published', '=', True)]])