def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
     if 'doctor_task_ids' in fields:
         activity_pool = self.pool['nh.activity']
         fields.remove('doctor_task_ids')
         read_values = super(nh_etake_list_clerking, self).read(cr, uid, ids, fields, context, load)
         for rv in read_values:
             rv['doctor_task_ids'] = activity_pool.search(cr, uid, [['parent_id', '=', rv['id']], ['data_model', '=', 'nh.clinical.doctor.task']], context=context)
         return read_values
     return super(nh_etake_list_clerking, self).read(cr, uid, ids, fields, context, load)
Exemple #2
0
 def toDict(self, cr, uid, ids, context=None):
     r = super(epson_ar_fiscal_tf_printer_configuration, self).toDict(cr, uid, ids, context=context)
     fields = self._columns.keys()
     fields.remove('user_ids')
     for conf in self.read(cr, uid, ids, fields, context=context):
         if conf['type'] == "epson_ar_tf":
             conf_id = conf['id']
             del conf['type']
             del conf['name']
             del conf['protocol']
             del conf['id']
             del conf['tail']  # Proceso especial.
             r[conf_id] = conf
     return r
Exemple #3
0
 def toDict(self, cr, uid, ids, context=None):
     r = super(epson_ar_fiscal_tf_printer_configuration, self).toDict(cr, uid, ids, context=context)
     fields = self._columns.keys()
     fields.remove('user_ids')
     for conf in self.read(cr, uid, ids, fields, context=context):
         if (conf['type'] == "epson_ar_tf"):
             conf_id = conf['id']
             del conf['type']
             del conf['name']
             del conf['protocol']
             del conf['id']
             del conf['tail'] # Proceso especial.
             r[conf_id] = conf
     return r
Exemple #4
0
 def read(self, cr, uid, ids, fields=None, context=None, load="_classic_read"):
     if "doctor_task_ids" in fields:
         activity_pool = self.pool["nh.activity"]
         fields.remove("doctor_task_ids")
         read_values = super(nh_etake_list_review, self).read(cr, uid, ids, fields, context, load)
         for rv in read_values:
             rv["doctor_task_ids"] = activity_pool.search(
                 cr,
                 uid,
                 [["parent_id", "=", rv["id"]], ["data_model", "=", "nh.clinical.doctor.task"]],
                 context=context,
             )
         return read_values
     return super(nh_etake_list_review, self).read(cr, uid, ids, fields, context, load)
Exemple #5
0
    def read_group(self,
                   cr,
                   uid,
                   domain,
                   fields,
                   groupby,
                   offset=0,
                   limit=None,
                   context=None,
                   orderby=False):
        # no reason to sum price_units
        if 'price_unit' in fields:
            fields.remove('price_unit')

        result = super(SaleOrderLine, self).read_group(cr,
                                                       uid,
                                                       domain,
                                                       fields,
                                                       groupby,
                                                       offset,
                                                       limit=limit,
                                                       context=context,
                                                       orderby=orderby)

        if groupby:
            group_key = groupby[0]
            cr.execute(
                """SELECT {g_key}, SUM(price_unit * product_uom_qty) AS subtotal
                FROM sale_order_line
                WHERE state NOT IN ('draft')
                AND suspended = 'false'
                GROUP BY {g_key}
            """.format(g_key=group_key))

            partners_subtotal = {
                row[group_key]: row['subtotal']
                for row in cr.dictfetchall()
            }

            for row in result:
                if isinstance(row[group_key], (list, tuple)):
                    g_key = row[group_key][0]
                else:
                    g_key = row[group_key]
                row['price_subtotal'] = partners_subtotal.get(g_key, 0)

        return result
Exemple #6
0
 def _store_set_values(self, cr, uid, ids, fields, context):
     """
     Override the method to have the proper computation in case of
     cost_price history.
     Calls the fields.function's "implementation function" for all
     ``fields``, on records with ``ids`` (taking care of respecting
     ``multi`` attributes), and stores the resulting values in the
     database directly.
     """
     if not ids:
         return True
     if 'cost_price' in fields:
         fields = list(set(fields))
         fields.remove('cost_price')
         self._set_field_name_values(cr, uid, ids, 'cost_price', context)
     res = super(product_product,
                 self)._store_set_values(cr, uid, ids, fields, context)
     return res
 def _store_set_values(self, cr, uid, ids, fields, context):
     """
     Override the method to have the proper computation in case of
     cost_price history.
     Calls the fields.function's "implementation function" for all
     ``fields``, on records with ``ids`` (taking care of respecting
     ``multi`` attributes), and stores the resulting values in the
     database directly.
     """
     if not ids:
         return True
     if 'cost_price' in fields:
         fields = list(set(fields))
         fields.remove('cost_price')
         self._set_field_name_values(cr, uid, ids, 'cost_price', context)
     res = super(product_product, self)._store_set_values(cr,
                                                          uid,
                                                          ids,
                                                          fields,
                                                          context)
     return res
Exemple #8
0
 def read(self,
          cr,
          uid,
          ids,
          fields=None,
          context=None,
          load='_classic_read'):
     if 'doctor_task_ids' in fields:
         activity_pool = self.pool['nh.activity']
         fields.remove('doctor_task_ids')
         read_values = super(nh_etake_list_clerking,
                             self).read(cr, uid, ids, fields, context, load)
         for rv in read_values:
             rv['doctor_task_ids'] = activity_pool.search(
                 cr,
                 uid, [['parent_id', '=', rv['id']],
                       ['data_model', '=', 'nh.clinical.doctor.task']],
                 context=context)
         return read_values
     return super(nh_etake_list_clerking,
                  self).read(cr, uid, ids, fields, context, load)
Exemple #9
0
 def read_group(self,
                cr,
                uid,
                domain,
                fields,
                groupby,
                offset=0,
                limit=None,
                context=None,
                orderby=False):
     if 'max_days_overdue' in fields:
         fields.remove('max_days_overdue')
     return super(account_mc_customer, self).read_group(cr,
                                                        uid,
                                                        domain,
                                                        fields,
                                                        groupby,
                                                        offset,
                                                        limit=limit,
                                                        context=context,
                                                        orderby=orderby)
Exemple #10
0
    def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
        # no reason to sum price_units
        fields.remove('price_unit')
        result = super(sale_order_line, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby)

        if groupby:
            group_key = groupby[0]
            cr.execute("""SELECT {g_key}, SUM(price_unit * product_uom_qty) AS subtotal
                FROM sale_order_line
                WHERE state NOT IN ('draft')
                AND suspended = 'false'
                GROUP BY {g_key}
            """.format(g_key=group_key))

            partners_subtotal = {row[group_key]: row['subtotal'] for row in cr.dictfetchall()}

            for row in result:
                if isinstance(row[group_key], (list, tuple)):
                    g_key = row[group_key][0]
                else:
                    g_key = row[group_key]
                row['price_subtotal'] = partners_subtotal.get(g_key, 0)

        return result
Exemple #11
0
 def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
     if 'max_days_overdue' in fields:
         fields.remove('max_days_overdue')
     return super(account_mc_customer, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby)
Exemple #12
0
 def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
     if 'max_days_overdue' in fields:
         fields.remove('max_days_overdue')
     return super(partner_aging_supplier, self).read_group(cr, uid, domain, fields, groupby, offset, limit=limit, context=context, orderby=orderby)