コード例 #1
0
class pos_configuration(osv.TransientModel):
    _inherit = 'res.config.settings'
    _name = 'pos.config.settings'

    _columns = {
        'module_pos_restaurant': fields.selection([
            (0, "Point of sale for shops"),
            (1, "Restaurant: activate table management")
            ], "Restaurant",
            help='This module adds several restaurant features to the Point of Sale: \n\n- Bill Printing: Allows you to print a receipt before the order is paid \n\n- Bill Splitting: Allows you to split an order into different orders \n\n- Kitchen Order Printing: allows you to print orders updates to kitchen or bar printers'),
        'module_pos_loyalty': fields.boolean("Loyalty Program",
            help='Allows you to define a loyalty program in the point of sale, where the customers earn loyalty points and get rewards'),
        'module_pos_discount': fields.selection([
            (0, "Allow discounts on order lines only"),
            (1, "Allow global discounts")
            ], "Discount",
            help='Allows the cashier to quickly give a percentage sale discount for all the sales order to a customer'),
        'module_pos_mercury': fields.selection([
            (0, "No credit card"),
            (1, "Allows customers to pay with credit cards.")
            ], "Credit Cards",
            help='The transactions are processed by MercuryPay'),
        'module_pos_reprint': fields.selection([
            (0, "No reprint"),
            (1, "Allow cashier to reprint receipts")
            ], "Reprints"),
    }
コード例 #2
0
class event_config_settings(osv.TransientModel):
    _name='event.config.settings'
    _inherit='res.config.settings'
    _columns = {
        'module_event_sale': fields.selection([
            (0, "All events are free"),
            (1, 'Allow selling tickets')
            ], "Tickets",
            help='Install the event_sale module'),
        'module_website_event_track': fields.selection([
            (0, "No mini website per event"),
            (1, 'Allow tracks, agenda and dedicated menus/website per event')
            ], "Tracks and Agenda",
            help='Install the module website_event_track'),
        'module_website_event_questions': fields.selection([
            (0, "No extra questions on subscriptions"),
            (1, 'Allow adding extra questions on subscriptions')
            ], "Subscription Survey",
            help='Install the website_event_questions module'),
        'auto_confirmation': fields.selection([
            (1, 'No validation step on subscription'),
            (0, "Manually confirm every subscription")
            ], "Auto Confirmation",
            help='Unselect this option to manually manage draft event and draft subscription'),
        'group_email_scheduling': fields.selection([
            (0, "No automated emails"),
            (1, 'Schedule emails to attendees and subscribers')
            ], "Email Scheduling",
            help='You will be able to configure emails, and to schedule them to be automatically sent to the attendees on subscription and/or attendance',
            implied_group='event.group_email_scheduling'),            
    }

    def set_default_auto_confirmation(self, cr, uid, ids, context=None):
        config_value = self.browse(cr, uid, ids, context=context).auto_confirmation
        self.pool.get('ir.values').set_default(cr, uid, 'event.config.settings', 'auto_confirmation', config_value)
コード例 #3
0
class res_partner(osv.osv):  
    """ add field to indicate default 'Communication Type' on customer invoices """
    _inherit = 'res.partner'
    
    def _get_comm_type(self, cr, uid, context=None):
        res = self.pool.get('account.invoice')._get_reference_type(cr, uid,context=context)
        return res
    
    _columns = {
        'out_inv_comm_type': fields.selection(_get_comm_type, 'Communication Type', change_default=True,
            help='Select Default Communication Type for Outgoing Invoices.' ),
        'out_inv_comm_algorithm': fields.selection([
            ('random','Random'),
            ('date','Date'),
            ('partner_ref','Customer Reference'),
            ], 'Communication Algorithm',
            help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
    }

    def _commercial_fields(self, cr, uid, context=None):
        return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
            ['out_inv_comm_type', 'out_inv_comm_algorithm']


    _default = {
        'out_inv_comm_type': 'none',
    }
コード例 #4
0
class stock_config_settings(osv.osv_memory):
    _inherit = 'stock.config.settings'

    _columns = {
        'group_stock_inventory_valuation':
        fields.selection(
            [(0, "Periodic inventory valuation (recommended)"),
             (1,
              'Perpetual inventory valuation (stock move generates accounting entries)'
              )],
            "Inventory Valuation",
            implied_group='stock_account.group_inventory_valuation',
            help=
            """Allows to configure inventory valuations on products and product categories."""
        ),
        'module_stock_landed_costs':
        fields.selection(
            [(0, 'No landed costs'),
             (1, 'Include landed costs in product costing computation')],
            "Landed Costs",
            help=
            """Install the module that allows to affect landed costs on pickings, and split them onto the different products."""
        ),
    }

    def onchange_landed_costs(self,
                              cr,
                              uid,
                              ids,
                              module_landed_costs,
                              context=None):
        if module_landed_costs:
            return {'value': {'group_stock_inventory_valuation': True}}
        return {}
コード例 #5
0
ファイル: anonymization.py プロジェクト: LiberTang0/5
class ir_model_fields_anonymization_history(osv.osv):
    _name = 'ir.model.fields.anonymization.history'
    _order = "date desc"

    _columns = {
        'date':
        fields.datetime('Date', required=True, readonly=True),
        'field_ids':
        fields.many2many('ir.model.fields.anonymization',
                         'anonymized_field_to_history_rel',
                         'field_id',
                         'history_id',
                         'Fields',
                         readonly=True),
        'state':
        fields.selection(selection=ANONYMIZATION_HISTORY_STATE,
                         string='Status',
                         required=True,
                         readonly=True),
        'direction':
        fields.selection(selection=ANONYMIZATION_DIRECTION,
                         string='Direction',
                         size=20,
                         required=True,
                         readonly=True),
        'msg':
        fields.text('Message', readonly=True),
        'filepath':
        fields.char(string='File path', readonly=True),
    }
コード例 #6
0
class mrp_config_settings(osv.osv_memory):
    _name = 'mrp.config.settings'
    _inherit = 'res.config.settings'

    _columns = {
        'group_product_variant':
        fields.selection(
            [(0, "No variants on products"),
             (1,
              'Products can have several attributes, defining variants (Example: size, color,...)'
              )],
            "Product Variants",
            help=
            'Work with product variant allows you to define some variant of the same products, an ease the product management in the ecommerce for example',
            implied_group='product.group_product_variant'),
        'module_mrp_operations':
        fields.selection(
            [(0, "Do not use a planning for the work orders "),
             (1, "Allow detailed planning of work orders")],
            "Work Order Planning",
            help=
            'This allows to add state, date_start,date_stop in production order operation lines (in the "Work Centers" tab).\n'
            '-This installs the module mrp_operations.'),
        'module_mrp_byproduct':
        fields.selection(
            [(0, "No by-products in bills of materials (A + B --> C)"),
             (1,
              "Bills of materials may produce residual products (A + B --> C + D)"
              )],
            "By-Products",
            help='You can configure by-products in the bill of material.\n'
            'Without this module: A + B + C -> D.\n'
            'With this module: A + B + C -> D + E.\n'
            '-This installs the module mrp_byproduct.'),
        'group_mrp_routings':
        fields.selection(
            [(0, "Manage production by manufacturing orders"),
             (1, "Manage production by work orders")],
            "Routings",
            implied_group='mrp.group_mrp_routings',
            help=
            'Work Order Operations allow you to create and manage the manufacturing operations that should be followed '
            'within your work centers in order to produce a product. They are attached to bills of materials '
            'that will define the required raw materials.'),
        'group_rounding_efficiency':
        fields.selection(
            [(0, "No rounding and efficiency on bills of materials"),
             (1,
              "Manage rounding and efficiency of bills of materials components"
              )],
            "Rounding efficiency",
            implied_group='mrp.group_rounding_efficiency',
            help=
            """Allow to manage product rounding on quantity and product efficiency during production process"""
        ),
    }
コード例 #7
0
ファイル: procurement.py プロジェクト: LiberTang0/5
class procurement_rule(osv.osv):
    '''
    A rule describe what a procurement should do; produce, buy, move, ...
    '''
    _name = 'procurement.rule'
    _description = "Procurement Rule"
    _order = "name"

    def _get_action(self, cr, uid, context=None):
        return []

    _columns = {
        'name':
        fields.char(
            'Name',
            required=True,
            translate=True,
            help=
            "This field will fill the packing origin and the name of its moves"
        ),
        'active':
        fields.boolean(
            'Active',
            help=
            "If unchecked, it will allow you to hide the rule without removing it."
        ),
        'group_propagation_option':
        fields.selection([('none', 'Leave Empty'), ('propagate', 'Propagate'),
                          ('fixed', 'Fixed')],
                         string="Propagation of Procurement Group"),
        'group_id':
        fields.many2one('procurement.group', 'Fixed Procurement Group'),
        'action':
        fields.selection(selection=lambda s, cr, uid, context=None: s.
                         _get_action(cr, uid, context=context),
                         string='Action',
                         required=True),
        'sequence':
        fields.integer('Sequence'),
        'company_id':
        fields.many2one('res.company', 'Company'),
    }

    _defaults = {
        'group_propagation_option': 'propagate',
        'sequence': 20,
        'active': True,
    }
コード例 #8
0
ファイル: resource.py プロジェクト: ecoreos/hz
class resource_resource(osv.osv):
    _name = "resource.resource"
    _description = "Resource Detail"
    _columns = {
        'name':
        fields.char("Name", required=True),
        'code':
        fields.char('Code', size=16, copy=False),
        'active':
        fields.boolean(
            'Active',
            track_visibility='onchange',
            help=
            "If the active field is set to False, it will allow you to hide the resource record without removing it."
        ),
        'company_id':
        fields.many2one('res.company', 'Company'),
        'resource_type':
        fields.selection([('user', 'Human'), ('material', 'Material')],
                         'Resource Type',
                         required=True),
        'user_id':
        fields.many2one(
            'res.users',
            'User',
            help='Related user name for the resource to manage its access.'),
        'time_efficiency':
        fields.float(
            'Efficiency Factor',
            size=8,
            required=True,
            help=
            "This field depict the efficiency of the resource to complete tasks. e.g  resource put alone on a phase of 5 days with 5 tasks assigned to him, will show a load of 100% for this phase by default, but if we put a efficiency of 200%, then his load will only be 50%."
        ),
        'calendar_id':
        fields.many2one("resource.calendar",
                        "Working Time",
                        help="Define the schedule of resource"),
    }

    _defaults = {
        'resource_type':
        'user',
        'time_efficiency':
        1,
        'active':
        True,
        'company_id':
        lambda self, cr, uid, context: self.pool.get('res.company').
        _company_default_get(cr, uid, 'resource.resource', context=context)
    }

    def copy(self, cr, uid, id, default=None, context=None):
        if default is None:
            default = {}
        if not default.get('name', False):
            default.update(name=_('%s (copy)') %
                           (self.browse(cr, uid, id, context=context).name))
        return super(resource_resource, self).copy(cr, uid, id, default,
                                                   context)
コード例 #9
0
ファイル: resource.py プロジェクト: ecoreos/hz
class resource_calendar_attendance(osv.osv):
    _name = "resource.calendar.attendance"
    _description = "Work Detail"

    _columns = {
        'name':
        fields.char("Name", required=True),
        'dayofweek':
        fields.selection([('0', 'Monday'),
                          ('1', 'Tuesday'), ('2', 'Wednesday'),
                          ('3', 'Thursday'), ('4', 'Friday'),
                          ('5', 'Saturday'), ('6', 'Sunday')],
                         'Day of Week',
                         required=True,
                         select=True),
        'date_from':
        fields.date('Starting Date'),
        'date_to':
        fields.date('End Date'),
        'hour_from':
        fields.float('Work from',
                     required=True,
                     help="Start and End time of working.",
                     select=True),
        'hour_to':
        fields.float("Work to", required=True),
        'calendar_id':
        fields.many2one("resource.calendar",
                        "Resource's Calendar",
                        required=True),
    }

    _order = 'dayofweek, hour_from'

    _defaults = {'dayofweek': '0'}
コード例 #10
0
class account_tax(osv.osv):
    """ Add fields used to define some brazilian taxes """
    _inherit = 'account.tax'

    _columns = {
        'tax_discount':
        fields.boolean('Discount this Tax in Prince',
                       help="Mark it for (ICMS, PIS e etc.)."),
        'base_reduction':
        fields.float('Redution',
                     required=True,
                     digits=0,
                     help="Um percentual decimal em % entre 0-1."),
        'amount_mva':
        fields.float('MVA Percent',
                     required=True,
                     digits=0,
                     help="Um percentual decimal em % entre 0-1."),
        'amount_type':
        fields.selection([('group', 'Group of Taxes'), ('fixed', 'Fixed'),
                          ('percent', 'Percentage of Price'),
                          ('division', 'Percentage of Price Tax Included')],
                         string="Tax Computation",
                         required=True)
    }
    _defaults = TAX_DEFAULTS
コード例 #11
0
class product_putaway_strategy(osv.osv):
    _name = 'product.putaway'
    _description = 'Put Away Strategy'

    def _get_putaway_options(self, cr, uid, context=None):
        return [('fixed', 'Fixed Location')]

    _columns = {
        'name':
        fields.char('Name', required=True),
        'method':
        fields.selection(_get_putaway_options, "Method", required=True),
        'fixed_location_ids':
        fields.one2many(
            'stock.fixed.putaway.strat',
            'putaway_id',
            'Fixed Locations Per Product Category',
            help=
            "When the method is fixed, this location will be used to store the products",
            copy=True),
    }

    _defaults = {
        'method': 'fixed',
    }

    def putaway_apply(self, cr, uid, putaway_strat, product, context=None):
        if putaway_strat.method == 'fixed':
            for strat in putaway_strat.fixed_location_ids:
                categ = product.categ_id
                while categ:
                    if strat.category_id.id == categ.id:
                        return strat.fixed_location_id.id
                    categ = categ.parent_id
コード例 #12
0
ファイル: ir_logging.py プロジェクト: LiberTang0/5
class ir_logging(osv.Model):
    _name = 'ir.logging'
    _order = 'id DESC'

    EXCEPTIONS_TYPE = [('client', 'Client'), ('server', 'Server')]

    _columns = {
        'create_date':
        fields.datetime('Create Date', readonly=True),
        'create_uid':
        fields.integer('Uid',
                       readonly=True),  # Integer not m2o is intentionnal
        'name':
        fields.char('Name', required=True),
        'type':
        fields.selection(EXCEPTIONS_TYPE,
                         string='Type',
                         required=True,
                         select=True),
        'dbname':
        fields.char('Database Name', select=True),
        'level':
        fields.char('Level', select=True),
        'message':
        fields.text('Message', required=True),
        'path':
        fields.char('Path', required=True),
        'func':
        fields.char('Function', required=True),
        'line':
        fields.char('Line', required=True),
    }
コード例 #13
0
class hr_holidays_summary_dept(osv.osv_memory):
    _name = 'hr.holidays.summary.dept'
    _description = 'HR Leaves Summary Report By Department'
    _columns = {
        'date_from':
        fields.date('From', required=True),
        'depts':
        fields.many2many('hr.department', 'summary_dept_rel', 'sum_id',
                         'dept_id', 'Department(s)'),
        'holiday_type':
        fields.selection([('Approved', 'Approved'), ('Confirmed', 'Confirmed'),
                          ('both', 'Both Approved and Confirmed')],
                         'Leave Type',
                         required=True)
    }

    _defaults = {
        'date_from': lambda *a: time.strftime('%Y-%m-01'),
        'holiday_type': 'Approved'
    }

    def print_report(self, cr, uid, ids, context=None):
        data = self.read(cr, uid, ids, context=context)[0]
        if not data['depts']:
            raise UserError(
                _('You have to select at least one Department. And try again.')
            )
        datas = {'ids': [], 'model': 'hr.department', 'form': data}
        return self.pool['report'].get_action(
            cr,
            uid,
            data['depts'],
            'hr_holidays.report_holidayssummary',
            data=datas,
            context=context)
コード例 #14
0
class res_partner_tags(osv.Model):
    _description = 'Partner Tags - These tags can be used on website to find customers by sector, or ... '
    _name = 'res.partner.tag'
    _inherit = 'website.published.mixin'

    def get_selection_class(self, cr, uid, context=None):
        classname = ['default', 'primary', 'success', 'warning', 'danger']
        return [(x, str.title(x)) for x in classname]

    _columns = {
        'name':
        fields.char('Category Name', required=True, translate=True),
        'partner_ids':
        fields.many2many('res.partner',
                         'res_partner_res_partner_tag_rel',
                         id1='tag_id',
                         id2='partner_id',
                         string='Partners'),
        'classname':
        fields.selection(get_selection_class,
                         'Class',
                         help="Bootstrap class to customize the color",
                         required=True),
        'active':
        fields.boolean('Active'),
    }
    _defaults = {
        'active': True,
        'website_published': True,
        'classname': 'default',
    }
コード例 #15
0
ファイル: res_config.py プロジェクト: LiberTang0/5
class MassMailingConfiguration(osv.TransientModel):
    _name = 'mass.mailing.config.settings'
    _inherit = 'res.config.settings'

    _columns = {
        'group_mass_mailing_campaign':
        fields.selection(
            [(0, "Do not organize and schedule mail campaigns (easy)"),
             (1, "Allow using marketing campaigns (advanced)")],
            "Campaigns",
            implied_group='mass_mailing.group_mass_mailing_campaign',
            help="""Manage mass mailign using Campaigns"""),
        'group_website_popup_on_exit':
        fields.
        selection([
            (0,
             'Do not add extra content on website pages to encourage visitors to sign up'
             ),
            (1,
             'Allow the use of a pop-up snippet on website to encourage visitors to sign up on a mass mailing list'
             )
        ],
                  string="Website Pop-up",
                  implied_group="mass_mailing.group_website_popup_on_exit"),
        'module_mass_mailing_themes':
        fields.boolean("Mass mailing themes"),
    }
コード例 #16
0
class hr_holidays_summary_employee(osv.osv_memory):
    _name = 'hr.holidays.summary.employee'
    _description = 'HR Leaves Summary Report By Employee'
    _columns = {
        'date_from':
        fields.date('From', required=True),
        'emp':
        fields.many2many('hr.employee', 'summary_emp_rel', 'sum_id', 'emp_id',
                         'Employee(s)'),
        'holiday_type':
        fields.selection([('Approved', 'Approved'), ('Confirmed', 'Confirmed'),
                          ('both', 'Both Approved and Confirmed')],
                         'Select Leave Type',
                         required=True)
    }

    _defaults = {
        'date_from': lambda *a: time.strftime('%Y-%m-01'),
        'holiday_type': 'Approved',
    }

    def print_report(self, cr, uid, ids, context=None):
        data = self.read(cr, uid, ids, context=context)[0]
        data['emp'] = context.get('active_ids', [])
        datas = {'ids': [], 'model': 'hr.employee', 'form': data}
        return self.pool['report'].get_action(
            cr,
            uid,
            data['emp'],
            'hr_holidays.report_holidayssummary',
            data=datas,
            context=context)
コード例 #17
0
class res_state(osv.osv):

    def name_get(self, cr, uid, ids, context=None):
        if not len(ids):
            return []
        res = []
        for state in self.browse(cr, uid, ids, context=context):
            data = []
            acc = state
            while acc:
                data.insert(0, acc.name)
                acc = acc.parent_id
            data = ' / '.join(data)
            res.append((state.id, (state.code and '[' + state.code + '] ' or '') + data))
        
        return res
        
    
    def complete_name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
        if not args:
            args = []
        args = args[:]
        ids = []
        if name:
            ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit)
            if not ids and len(name.split()) >= 2:
                #Separating code and name of account for searching
                operand1,operand2 = name.split(': ',1) #name can contain spaces e.g. eCore
                ids = self.search(cr, user, [('name', operator, operand2)]+ args, limit=limit)
        else:
            ids = self.search(cr, user, args, context=context, limit=limit)
        return self.name_get(cr, user, ids, context=context)
    
    def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
        if not ids:
            return []
        res = []
        for state in self.browse(cr, uid, ids, context=context):
            data = []
            acc = state
            while acc:
                data.insert(0, acc.name)
                acc = acc.parent_id
            data = ' / '.join(data)
            res.append((state.id, data))
        return dict(res)
        
    _name = 'res.country.state'
    _inherit = 'res.country.state'
    _columns = {
            'code': fields.char('State Code', size=32,help='The state code.\n', required=True),
            'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Complete Name', fnct_search=complete_name_search),
            'parent_id': fields.many2one('res.country.state','Parent State', select=True, domain=[('type','=','view')]),
            'child_ids': fields.one2many('res.country.state', 'parent_id', string='Child States'),
            'type': fields.selection([('view','View'), ('normal','Normal')], 'Type'),
        }
    _defaults = {
            'type': 'normal',
        }
コード例 #18
0
ファイル: test_models.py プロジェクト: ecoreos/hz
class test_converter(orm.Model):
    _name = 'web_editor.converter.test'

    # disable translation export for those brilliant field labels and values
    _translate = False

    _columns = {
        'char':
        fields.char(),
        'integer':
        fields.integer(),
        'float':
        fields.float(),
        'numeric':
        fields.float(digits=(16, 2)),
        'many2one':
        fields.many2one('web_editor.converter.test.sub'),
        'binary':
        fields.binary(),
        'date':
        fields.date(),
        'datetime':
        fields.datetime(),
        'selection':
        fields.selection([
            (1, "réponse A"),
            (2, "réponse B"),
            (3, "réponse C"),
            (4, "réponse D"),
        ]),
        'selection_str':
        fields.selection(
            [
                ('A', "Qu'il n'est pas arrivé à Toronto"),
                ('B', "Qu'il était supposé arriver à Toronto"),
                ('C', "Qu'est-ce qu'il fout ce maudit pancake, tabernacle ?"),
                ('D', "La réponse D"),
            ],
            string=
            u"Lorsqu'un pancake prend l'avion à destination de Toronto et "
            u"qu'il fait une escale technique à St Claude, on dit:"),
        'html':
        fields.html(),
        'text':
        fields.text(),
    }
コード例 #19
0
class MassMailingReport(osv.Model):
    _name = 'mail.statistics.report'
    _auto = False
    _description = 'Mass Mailing Statistics'

    _columns = {
        'scheduled_date':
        fields.datetime('Scheduled Date', readonly=True),
        'name':
        fields.char('Mass Mail', readonly=True),
        'campaign':
        fields.char('Mass Mail Campaign', readonly=True),
        'sent':
        fields.integer('Sent', readonly=True),
        'delivered':
        fields.integer('Delivered', readonly=True),
        'opened':
        fields.integer('Opened', readonly=True),
        'bounced':
        fields.integer('Bounced', readonly=True),
        'replied':
        fields.integer('Replied', readonly=True),
        'state':
        fields.selection(
            [('draft', 'Draft'), ('test', 'Tested'), ('done', 'Sent')],
            string='Status',
            readonly=True,
        ),
        'email_from':
        fields.char('From', readonly=True),
    }

    def init(self, cr):
        """Mass Mail Statistical Report: based on mail.mail.statistics that models the various
        statistics collected for each mailing, and mail.mass_mailing model that models the
        various mailing performed. """
        tools.drop_view_if_exists(cr, 'mail_statistics_report')
        cr.execute("""
            CREATE OR REPLACE VIEW mail_statistics_report AS (
                SELECT
                    min(ms.id) as id,
                    ms.scheduled as scheduled_date,
                    mm.name as name,
                    mc.name as campaign,
                    count(ms.bounced) as bounced,
                    count(ms.sent) as sent,
                    (count(ms.sent) - count(ms.bounced)) as delivered,
                    count(ms.opened) as opened,
                    count(ms.replied) as replied,
                    mm.state,
                    mm.email_from
                FROM
                    mail_mail_statistics as ms
                    left join mail_mass_mailing as mm ON (ms.mass_mailing_id=mm.id)
                    left join mail_mass_mailing_campaign as mc ON (ms.mass_mailing_campaign_id=mc.id)
                GROUP BY ms.scheduled, mm.name, mc.name, mm.state, mm.email_from
            )""")
コード例 #20
0
ファイル: models.py プロジェクト: ecoreos/hz
class SelectionWithDefault(orm.Model):
    _name = 'export.selection.withdefault'
    _columns = {
        'const': fields.integer(),
        'value': fields.selection([(1, "Foo"), (2, "Bar")]),
    }
    _defaults = {
        'const': 4,
        'value': 2,
    }
コード例 #21
0
class lead_test(osv.Model):
    _name = "base.action.rule.lead.test"
    _description = "Action Rule Test"

    _columns = {
        'name':
        fields.char('Subject', required=True, select=1),
        'user_id':
        fields.many2one('res.users', 'Responsible'),
        'state':
        fields.selection(AVAILABLE_STATES, string="Status", readonly=True),
        'active':
        fields.boolean('Active', required=False),
        'partner_id':
        fields.many2one('res.partner', 'Partner', ondelete='set null'),
        'date_action_last':
        fields.datetime('Last Action', readonly=1),
        'line_ids':
        fields.one2many('base.action.rule.line.test', 'lead_id'),
    }

    _defaults = {
        'state': 'draft',
        'active': True,
    }

    customer = ecore.fields.Boolean(related='partner_id.customer',
                                    readonly=True,
                                    store=True)

    @api.cr_uid_ids_context
    def message_post(self,
                     cr,
                     uid,
                     thread_id,
                     body='',
                     subject=None,
                     message_type='notification',
                     subtype=None,
                     parent_id=False,
                     attachments=None,
                     context=None,
                     **kwargs):
        pass

    def message_subscribe(self,
                          cr,
                          uid,
                          ids,
                          partner_ids=None,
                          channel_ids=None,
                          subtype_ids=None,
                          force=True,
                          context=None):
        pass
コード例 #22
0
class product_pricelist(osv.osv):
    _inherit = 'product.pricelist'

    _columns = {
        'discount_policy':
        fields.selection(
            [('with_discount', 'Discount included in the price'),
             ('without_discount', 'Show discount in the sale order')],
            string="Discount Policy"),
    }
    _defaults = {'discount_policy': 'with_discount'}
コード例 #23
0
ファイル: product.py プロジェクト: ecoreos/hz
class product_attribute(osv.Model):
    _inherit = "product.attribute"
    _columns = {
        'type':
        fields.selection([('radio', 'Radio'), ('select', 'Select'),
                          ('color', 'Color'), ('hidden', 'Hidden')],
                         string="Type"),
    }
    _defaults = {
        'type': lambda *a: 'radio',
    }
コード例 #24
0
class product_template(osv.osv):
    _inherit = "product.template"

    _columns = {
        'landed_cost_ok': fields.boolean('Landed Costs'),
        'split_method': fields.selection(SPLIT_METHOD, 'Split Method'),
    }

    _defaults = {
        'landed_cost_ok': False,
        'split_method': 'equal',
    }
コード例 #25
0
class project_configuration(osv.osv_memory):
    _name = 'project.config.settings'
    _inherit = 'project.config.settings'

    _columns = {
        'group_tasks_work_on_tasks':
        fields.selection([(0, "Do not log work activities on task"),
                          (1, "Log work activities on tasks")],
                         "Activity Log",
                         implied_group='project.group_tasks_work_on_tasks',
                         help="Allows you to compute work on tasks."),
    }
コード例 #26
0
class base_gengo_translations(osv.osv_memory):
    GENGO_KEY = "Gengo.UUID"
    GROUPS = ['base.group_system']

    _name = 'base.gengo.translations'
    _columns = {
        'sync_type': fields.selection([('send', 'Send New Terms'),
                                       ('receive', 'Receive Translation'),
                                       ('both', 'Both')], "Sync Type", required=True),
        'lang_id': fields.many2one('res.lang', 'Language', required=True),
        'sync_limit': fields.integer("No. of terms to sync"),
    }
    _defaults = {
        'sync_type': 'both',
        'sync_limit': 20
    }

    def init(self, cr):
        icp = self.pool['ir.config_parameter']
        if not icp.get_param(cr, SUPERUSER_ID, self.GENGO_KEY, default=None):
            icp.set_param(cr, SUPERUSER_ID, self.GENGO_KEY, str(uuid.uuid4()), groups=self.GROUPS)

    def get_gengo_key(self, cr):
        icp = self.pool['ir.config_parameter']
        return icp.get_param(cr, SUPERUSER_ID, self.GENGO_KEY, default="Undefined")

    def gengo_authentication(self, cr, uid, context=None):
        '''
        This method tries to open a connection with Gengo. For that, it uses the Public and Private
        keys that are linked to the company (given by Gengo on subscription). It returns a tuple with
         * as first element: a boolean depicting if the authentication was a success or not
         * as second element: the connection, if it was a success, or the error message returned by
            Gengo when the connection failed.
            This error message can either be displayed in the server logs (if the authentication was called
            by the cron) or in a dialog box (if requested by the user), thus it's important to return it
            translated.
        '''
        user = self.pool.get('res.users').browse(cr, 1, uid, context=context)
        if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key:
            return (False, _("Gengo `Public Key` or `Private Key` are missing. Enter your Gengo authentication parameters under `Settings > Companies > Gengo Parameters`."))
        try:
            gengo = Gengo(
                public_key=user.company_id.gengo_public_key.encode('ascii'),
                private_key=user.company_id.gengo_private_key.encode('ascii'),
                sandbox=user.company_id.gengo_sandbox,
            )
            gengo.getAccountStats()
            return (True, gengo)
        except Exception, e:
            _logger.exception('Gengo connection failed')
            return (False, _("Gengo connection failed with this message:\n``%s``") % e)
コード例 #27
0
class base_language_install(osv.osv_memory):
    """ Install Language"""

    _name = "base.language.install"
    _description = "Install Language"
    _columns = {
        'lang': fields.selection(tools.scan_languages(),'Language', required=True),
        'overwrite': fields.boolean('Overwrite Existing Terms', help="If you check this box, your customized translations will be overwritten and replaced by the official ones."),
        'state':fields.selection([('init','init'),('done','done')], 'Status', readonly=True),
    }
    _defaults = {
        'state': 'init',
        'overwrite': False
    }
    def lang_install(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        language_obj = self.browse(cr, uid, ids)[0]
        lang = language_obj.lang
        if lang:
            modobj = self.pool.get('ir.module.module')
            mids = modobj.search(cr, uid, [('state', '=', 'installed')])
            if language_obj.overwrite:
                context = {'overwrite': True}
            modobj.update_translations(cr, uid, mids, lang, context or {})
            self.write(cr, uid, ids, {'state': 'done'}, context=context)
        return {
            'name': _('Language Pack'),
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': False,
            'res_model': 'base.language.install',
            'domain': [],
            'context': dict(context, active_ids=ids),
            'type': 'ir.actions.act_window',
            'target': 'new',
            'res_id': ids and ids[0] or False,
        }
コード例 #28
0
class res_company(osv.osv):
    _inherit = 'res.company'
    _columns = {
        'timesheet_range': fields.selection(
            [('day','Day'),('week','Week'),('month','Month')], 'Timesheet range',
            help="Periodicity on which you validate your timesheets."),
        'timesheet_max_difference': fields.float('Timesheet allowed difference(Hours)',
            help="Allowed difference in hours between the sign in/out and the timesheet " \
                 "computation for one sheet. Set this to 0 if you do not want any control."),
    }
    _defaults = {
        'timesheet_range': lambda *args: 'week',
        'timesheet_max_difference': lambda *args: 0.0
    }
コード例 #29
0
ファイル: mrp_operations.py プロジェクト: LiberTang0/5
class mrp_operations_operation_code(osv.osv):
    _name = "mrp_operations.operation.code"
    _columns = {
        'name':
        fields.char('Operation Name', required=True),
        'code':
        fields.char('Code', size=16, required=True),
        'start_stop':
        fields.selection([('start', 'Start'), ('pause', 'Pause'),
                          ('resume', 'Resume'), ('cancel', 'Cancelled'),
                          ('done', 'Done')],
                         'Status',
                         required=True),
    }
コード例 #30
0
class hr_action_reason(osv.osv):
    _name = "hr.action.reason"
    _description = "Action Reason"
    _columns = {
        'name':
        fields.char('Reason',
                    required=True,
                    help='Specifies the reason for Signing In/Signing Out.'),
        'action_type':
        fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')],
                         "Action Type"),
    }
    _defaults = {
        'action_type': 'sign_in',
    }
コード例 #31
0
ファイル: models.py プロジェクト: genuineaffairs/ecore5
    """ just so CreatorCase.export can be used
    """
    pass

models = [
    ('boolean', fields.boolean()),
    ('integer', fields.integer()),
    ('float', fields.float()),
    ('decimal', fields.float(digits=(16, 3))),
    ('string.bounded', fields.char('unknown', size=16)),
    ('string.required', fields.char('unknown', size=None, required=True)),
    ('string', fields.char('unknown', size=None)),
    ('date', fields.date()),
    ('datetime', fields.datetime()),
    ('text', fields.text()),
    ('selection', fields.selection([(1, "Foo"), (2, "Bar"), (3, "Qux"), (4, '')])),
    # here use size=-1 to store the values as integers instead of strings
    ('selection.function', fields.selection(selection_fn, size=-1)),
    # just relate to an integer
    ('many2one', fields.many2one('export.integer')),
    ('one2many', fields.one2many('export.one2many.child', 'parent_id')),
    ('many2many', fields.many2many('export.many2many.other')),
    ('function', fields.function(function_fn, fnct_inv=function_fn_write, type="integer")),
    # related: specialization of fields.function, should work the same way
    # TODO: reference
]

for name, field in models:
    class NewModel(orm.Model):
        _name = 'export.%s' % name
        _columns = {