Example #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"),
    }
Example #2
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 {}
Example #3
0
class HeaderHTML(osv.osv):
    """HTML Header allows you to define HTML CSS and Page format"""

    _name = "ir.header_webkit"
    _columns = {
        'company_id' : fields.many2one('res.company', 'Company'),
        'html' : fields.text('webkit header', help="Set Webkit Report Header"),
        'footer_html' : fields.text('webkit footer', help="Set Webkit Report Footer."),
        'css' : fields.text('Header CSS'),
        'name' : fields.char('Name', required=True),
        'margin_top' : fields.float('Top Margin (mm)'),
        'margin_bottom' : fields.float('Bottom Margin (mm)'),
        'margin_left' : fields.float('Left Margin (mm)'),
        'margin_right' : fields.float('Right Margin (mm)'),
        'orientation' : fields.selection(
                        [('Landscape','Landscape'),('Portrait', 'Portrait')],
                        'Orientation',
                        ),
        'format': fields.selection(
                [
                ('A0' ,'A0  5   841 x 1189 mm'),
                ('A1' ,'A1  6   594 x 841 mm'),
                ('A2' ,'A2  7   420 x 594 mm'),
                ('A3' ,'A3  8   297 x 420 mm'),
                ('A4' ,'A4  0   210 x 297 mm, 8.26 x 11.69 inches'),
                ('A5' ,'A5  9   148 x 210 mm'),
                ('A6' ,'A6  10  105 x 148 mm'),
                ('A7' ,'A7  11  74 x 105 mm'),
                ('A8' ,'A8  12  52 x 74 mm'),
                ('A9' ,'A9  13  37 x 52 mm'),
                ('B0' ,'B0  14  1000 x 1414 mm'),
                ('B1' ,'B1  15  707 x 1000 mm'),
                ('B2' ,'B2  17  500 x 707 mm'),
                ('B3' ,'B3  18  353 x 500 mm'),
                ('B4' ,'B4  19  250 x 353 mm'),
                ('B5' ,'B5  1   176 x 250 mm, 6.93 x 9.84 inches'),
                ('B6' ,'B6  20  125 x 176 mm'),
                ('B7' ,'B7  21  88 x 125 mm'),
                ('B8' ,'B8  22  62 x 88 mm'),
                ('B9' ,'B9  23  33 x 62 mm'),
                ('B10',':B10    16  31 x 44 mm'),
                ('C5E','C5E 24  163 x 229 mm'),
                ('Comm10E','Comm10E 25  105 x 241 mm, U.S. Common 10 Envelope'),
                ('DLE', 'DLE 26 110 x 220 mm'),
                ('Executive','Executive 4   7.5 x 10 inches, 190.5 x 254 mm'),
                ('Folio','Folio 27  210 x 330 mm'),
                ('Ledger', 'Ledger  28  431.8 x 279.4 mm'),
                ('Legal', 'Legal    3   8.5 x 14 inches, 215.9 x 355.6 mm'),
                ('Letter','Letter 2 8.5 x 11 inches, 215.9 x 279.4 mm'),
                ('Tabloid', 'Tabloid 29 279.4 x 431.8 mm'),
                ],
                'Paper size',
                required=True,
                help="Select Proper Paper size"
        )
    }
Example #4
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"""
        ),
    }
Example #5
0
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,
    }
Example #6
0
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)
Example #7
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)
Example #8
0
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"),
    }
Example #9
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',
    }
Example #10
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)
Example #11
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
Example #12
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
Example #13
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)
Example #14
0
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(),
    }
Example #15
0
class oa_journal_report(osv.osv):
    _name = "oa.journal.report"
    _description = "OA Journal Statistics"
    _auto = False
    _rec_name = 'paidon'
    _columns = {
        'create_date':
        fields.datetime('创建时间', readonly=True),
        'invoice_type':
        fields.many2one('oa_journal.invoice.type',
                        string="发票类型",
                        readonly=True),
        'total_debit':
        fields.float(digits=(12, 2), string="金额", readonly=True),
        'mode_of_payment':
        fields.selection([('Cash', '现金'), ('Tenpay', '财付通支付'),
                          ('Alipay', '支付宝支付'), ('Transfer', '网银转账'),
                          ('Credit', '信用卡支付'), ('Wechat', '微信支付')],
                         string="付款方式",
                         readonly=True),
        'payer_employee':
        fields.many2one("hr.employee", string="付款人", readonly=True),
        'paidon':
        fields.datetime(string="付款时间", readonly=True),
        'collar_employee':
        fields.many2one("hr.employee", "领用人", readonly=True),
        'state':
        fields.selection([('draft', '草稿'), ('paid', '已付款'),
                          ('received', '已收获'), ('expensed', '已报销'),
                          ('closed', '关闭')],
                         string="状态",
                         readonly=True),
        'ec_platform':
        fields.many2one("oa_journal.ecplatform", '电商平台', readonly=True)
    }
    _order = 'paidon desc'

    def init(self, cr):
        tools.drop_view_if_exists(cr, 'oa_journal_report')
        cr.execute("""
            create or replace view oa_journal_report as (
                 select * from oa_journal
            )
        """)
Example #16
0
class report_document_user(osv.osv):
    _name = "report.document.user"
    _description = "Files details by Users"
    _auto = False
    _columns = {
        'name':
        fields.char('Year', size=64, readonly=True),
        'month':
        fields.selection([('01', 'January'), ('02', 'February'),
                          ('03', 'March'), ('04', 'April'), ('05', 'May'),
                          ('06', 'June'), ('07', 'July'), ('08', 'August'),
                          ('09', 'September'), ('10', 'October'),
                          ('11', 'November'), ('12', 'December')],
                         'Month',
                         readonly=True),
        'user_id':
        fields.many2one('res.users', 'Owner', readonly=True),
        'user':
        fields.related('user_id', 'name', type='char', size=64, readonly=True),
        'directory':
        fields.char('Directory', size=64, readonly=True),
        'datas_fname':
        fields.char('File Name', size=64, readonly=True),
        'create_date':
        fields.datetime('Date Created', readonly=True),
        'change_date':
        fields.datetime('Modified Date', readonly=True),
        'file_size':
        fields.integer('File Size', readonly=True),
        'nbr':
        fields.integer('# of Files', readonly=True),
        'type':
        fields.char('Directory Type', size=64, readonly=True),
    }

    def init(self, cr):
        tools.drop_view_if_exists(cr, 'report_document_user')
        cr.execute("""
            CREATE OR REPLACE VIEW report_document_user as (
                 SELECT
                     min(f.id) as id,
                     to_char(f.create_date, 'YYYY') as name,
                     to_char(f.create_date, 'MM') as month,
                     f.user_id as user_id,
                     count(*) as nbr,
                     d.name as directory,
                     f.datas_fname as datas_fname,
                     f.create_date as create_date,
                     f.file_size as file_size,
                     min(d.type) as type,
                     f.write_date as change_date
                 FROM ir_attachment f
                     left join document_directory d on (f.parent_id=d.id and d.name<>'')
                 group by to_char(f.create_date, 'YYYY'), to_char(f.create_date, 'MM'),d.name,f.parent_id,d.type,f.create_date,f.user_id,f.file_size,d.type,f.write_date,f.datas_fname
             )
        """)
Example #17
0
class SelectionWithDefault(orm.Model):
    _name = 'export.selection.withdefault'
    _columns = {
        'const': fields.integer(),
        'value': fields.selection([(1, "Foo"), (2, "Bar")]),
    }
    _defaults = {
        'const': 4,
        'value': 2,
    }
Example #18
0
class hr_employee_be(osv.osv):
    _inherit = 'hr.employee'

    _columns = {
        'spouse_fiscal_status': fields.selection([('without income','Without Income'),('with income','With Income')], 'Tax status for spouse'),
        'disabled_spouse_bool': fields.boolean('Disabled Spouse', help="if recipient spouse is declared disabled by law"),
        'disabled_children_bool': fields.boolean('Disabled Children', help="if recipient children is/are declared disabled by law"),
        'resident_bool': fields.boolean('Nonresident', help="if recipient lives in a foreign country"),
        'disabled_children_number': fields.integer('Number of disabled children'),
    }
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'}
Example #20
0
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',
    }
Example #21
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."),
    }
Example #22
0
class res_partner(osv.osv):
    _inherit = 'res.partner'
    _columns = {
        'sale_warn':
        fields.selection(WARNING_MESSAGE,
                         'Sales Order',
                         help=WARNING_HELP,
                         required=True),
        'sale_warn_msg':
        fields.text('Message for Sales Order'),
        'purchase_warn':
        fields.selection(WARNING_MESSAGE,
                         'Purchase Order',
                         help=WARNING_HELP,
                         required=True),
        'purchase_warn_msg':
        fields.text('Message for Purchase Order'),
        'picking_warn':
        fields.selection(WARNING_MESSAGE,
                         'Stock Picking',
                         help=WARNING_HELP,
                         required=True),
        'picking_warn_msg':
        fields.text('Message for Stock Picking'),
        'invoice_warn':
        fields.selection(WARNING_MESSAGE,
                         'Invoice',
                         help=WARNING_HELP,
                         required=True),
        'invoice_warn_msg':
        fields.text('Message for Invoice'),
    }
    _defaults = {
        'sale_warn': 'no-message',
        'purchase_warn': 'no-message',
        'picking_warn': 'no-message',
        'invoice_warn': 'no-message',
    }
Example #23
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
    }
Example #24
0
class stock_landed_cost_lines(osv.osv):
    _name = 'stock.landed.cost.lines'
    _description = 'Stock Landed Cost Lines'

    def onchange_product_id(self,
                            cr,
                            uid,
                            ids,
                            product_id=False,
                            context=None):
        result = {}
        if not product_id:
            return {'value': {'quantity': 0.0, 'price_unit': 0.0}}

        product = self.pool.get('product.product').browse(cr,
                                                          uid,
                                                          product_id,
                                                          context=context)
        result['name'] = product.name
        result['split_method'] = product.split_method
        result['price_unit'] = product.standard_price
        result[
            'account_id'] = product.property_account_expense_id and product.property_account_expense_id.id or product.categ_id.property_account_expense_categ_id.id
        return {'value': result}

    _columns = {
        'name':
        fields.char('Description'),
        'cost_id':
        fields.many2one('stock.landed.cost',
                        'Landed Cost',
                        required=True,
                        ondelete='cascade'),
        'product_id':
        fields.many2one('product.product', 'Product', required=True),
        'price_unit':
        fields.float('Cost',
                     required=True,
                     digits_compute=dp.get_precision('Product Price')),
        'split_method':
        fields.selection(product.SPLIT_METHOD,
                         string='Split Method',
                         required=True),
        'account_id':
        fields.many2one('account.account',
                        'Account',
                        domain=[('internal_type', '!=', 'view'),
                                ('internal_type', '!=', 'closed'),
                                ('deprecated', '=', False)]),
    }
Example #25
0
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),
    }
Example #26
0
class product_product(osv.osv):
    _inherit = 'product.template'
    _columns = {
        'sale_line_warn':
        fields.selection(WARNING_MESSAGE,
                         'Sales Order Line',
                         help=WARNING_HELP,
                         required=True),
        'sale_line_warn_msg':
        fields.text('Message for Sales Order Line'),
        'purchase_line_warn':
        fields.selection(WARNING_MESSAGE,
                         'Purchase Order Line',
                         help=WARNING_HELP,
                         required=True),
        'purchase_line_warn_msg':
        fields.text('Message for Purchase Order Line'),
    }

    _defaults = {
        'sale_line_warn': 'no-message',
        'purchase_line_warn': 'no-message',
    }
Example #27
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',
    }
Example #28
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',
    }
Example #29
0
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'
    }
Example #30
0
class procurement_group(osv.osv):
    '''
    The procurement group class is used to group products together
    when computing procurements. (tasks, physical products, ...)

    The goal is that when you have one sale order of several products
    and the products are pulled from the same or several location(s), to keep
    having the moves grouped into pickings that represent the sale order.

    Used in: sales order (to group delivery order lines like the so), pull/push
    rules (to pack like the delivery order), on orderpoints (e.g. for wave picking
    all the similar products together).

    Grouping is made only if the source and the destination is the same.
    Suppose you have 4 lines on a picking from Output where 2 lines will need
    to come from Input (crossdock) and 2 lines coming from Stock -> Output As
    the four procurement orders will have the same group ids from the SO, the
    move from input will have a stock.picking with 2 grouped lines and the move
    from stock will have 2 grouped lines also.

    The name is usually the name of the original document (sale order) or a
    sequence computed if created manually.
    '''
    _name = 'procurement.group'
    _description = 'Procurement Requisition'
    _order = "id desc"
    _columns = {
        'name':
        fields.char('Reference', required=True),
        'move_type':
        fields.selection([('direct', 'Partial'), ('one', 'All at once')],
                         'Delivery Method',
                         required=True),
        'procurement_ids':
        fields.one2many('procurement.order', 'group_id', 'Procurements'),
    }
    _defaults = {
        'name':
        lambda self, cr, uid, c: self.pool.get('ir.sequence').next_by_code(
            cr, uid, 'procurement.group') or '',
        'move_type':
        lambda self, cr, uid, c: 'direct'
    }