avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00683
Re: [Merge] lp:~oihanecruce/avanzosc/nayar_dos_contracts into lp:~avanzosc-security-team/avanzosc/72horas
Review: Needs Fixing code review
Siguen faltando muchos de los comentarios que te hice en la revisión pasada. Los he vuelto a poner.
Un saludo.
Diff comments:
> === modified file 'nayar_dos_contracts/__init__.py'
> --- nayar_dos_contracts/__init__.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/__init__.py 2014-07-07 08:55:17 +0000
> @@ -19,11 +19,4 @@
> #
> ##############################################################################
>
> -import contract
> -import invoice
> -import partner
> -import sale
> -import stock
> -import template
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> +from . import models
>
> === modified file 'nayar_dos_contracts/__openerp__.py'
> --- nayar_dos_contracts/__openerp__.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/__openerp__.py 2014-07-07 08:55:17 +0000
> @@ -25,15 +25,15 @@
> "author": "Nayar Systems",
> "category": "Enterprise Specific Modules",
> "description": "DOS Contracts extendido",
> - "depends": ["dos_contracts"],
> - "init_xml": [],
> - "demo_xml": [],
> - "update_xml": [
> - "contract_view.xml",
> - "invoice_view.xml",
> - "partner_view.xml",
> - "sale_view.xml",
> - "template_view.xml",
> + "depends": [
> + "dos_contracts"
> + ],
> + "data": [
> + "views/contract_view.xml",
> + "views/invoice_view.xml",
> + "views/partner_view.xml",
> + "views/sale_view.xml",
> + "views/template_view.xml",
> "security/ir.model.access.csv",
> "data/contract_data.xml",
> ],
> @@ -41,4 +41,3 @@
> "active": False,
> "installable": True
> }
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>
> === modified file 'nayar_dos_contracts/data/contract_data.xml'
> --- nayar_dos_contracts/data/contract_data.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/data/contract_data.xml 2014-07-07 08:55:17 +0000
> @@ -1,39 +1,35 @@
> <?xml version="1.0" encoding="utf-8"?>
> <openerp>
> - <data noupdate="1">
> - <!--
> - Tipos de secuencias
> - -->
> - <record id="seq_type_contract" model="ir.sequence.type">
> - <field name="name">Contratos</field>
> - <field name="code">contract.contract</field>
> - </record>
> - <record id="seq_type_contract_annexe" model="ir.sequence.type">
> - <field name="name">Anexos de Contrato</field>
> - <field name="code">contract.annexe</field>
> - </record>
> - <record id="seq_type_contract_annexe_ship" model="ir.sequence.type">
> - <field name="name">Núm. Anexo Envío</field>
> - <field name="code">contract.annexe.ship</field>
> - </record>
> + <data noupdate="1">
> + <!-- Tipos de secuencias -->
> + <record id="seq_type_contract" model="ir.sequence.type">
> + <field name="name">Contratos</field>
> + <field name="code">contract.contract</field>
> + </record>
> + <record id="seq_type_contract_annexe" model="ir.sequence.type">
> + <field name="name">Anexos de Contrato</field>
> + <field name="code">contract.annexe</field>
> + </record>
> + <record id="seq_type_contract_annexe_ship" model="ir.sequence.type">
> + <field name="name">Núm. Anexo Envío</field>
> + <field name="code">contract.annexe.ship</field>
> + </record>
>
> - <!--
> - Secuencias para contratos
> - -->
> - <record id="seq_contract" model="ir.sequence">
> - <field name="name">Contratos</field>
> - <field name="code">contract.contract</field>
> - <field name="padding" eval="4"/>
> - </record>
> - <record id="seq_contract_annexe" model="ir.sequence">
> - <field name="name">Anexos de Contrato</field>
> - <field name="code">contract.annexe</field>
> - <field name="padding" eval="4"/>
> - </record>
> - <record id="seq_contract_annexe_ship" model="ir.sequence">
> - <field name="name">Núm. Anexo Envío</field>
> - <field name="code">contract.annexe.ship</field>
> - <field name="padding" eval="4"/>
> - </record>
> - </data>
> + <!-- Secuencias para contratos -->
> + <record id="seq_contract" model="ir.sequence">
> + <field name="name">Contratos</field>
> + <field name="code">contract.contract</field>
> + <field name="padding" eval="4" />
> + </record>
> + <record id="seq_contract_annexe" model="ir.sequence">
> + <field name="name">Anexos de Contrato</field>
> + <field name="code">contract.annexe</field>
> + <field name="padding" eval="4" />
> + </record>
> + <record id="seq_contract_annexe_ship" model="ir.sequence">
> + <field name="name">Núm. Anexo Envío</field>
> + <field name="code">contract.annexe.ship</field>
> + <field name="padding" eval="4" />
> + </record>
> + </data>
> </openerp>
>
> === added directory 'nayar_dos_contracts/models'
> === added file 'nayar_dos_contracts/models/__init__.py'
> --- nayar_dos_contracts/models/__init__.py 1970-01-01 00:00:00 +0000
> +++ nayar_dos_contracts/models/__init__.py 2014-07-07 08:55:17 +0000
> @@ -0,0 +1,26 @@
> +# -*- coding: utf-8 -*-
> +##############################################################################
> +#
> +# OpenERP, Open Source Management Solution
> +# Copyright (C) 2013 Nayar Systems (<http://www.72horas.net/>)
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU Affero General Public License as
> +# published by the Free Software Foundation, either version 3 of the
> +# License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU Affero General Public License for more details.
> +#
> +# You should have received a copy of the GNU Affero General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +
> +from . import contract
> +from . import invoice
> +from . import sale
> +from . import stock
> +from . import template
>
> === renamed file 'nayar_dos_contracts/contract.py' => 'nayar_dos_contracts/models/contract.py'
> --- nayar_dos_contracts/contract.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/models/contract.py 2014-07-07 08:55:17 +0000
> @@ -21,9 +21,10 @@
>
> from datetime import datetime
> from dateutil.relativedelta import relativedelta
> -from osv import osv, fields
> -
> -class contract_type(osv.osv):
> +from openerp.osv import orm, fields
> +
> +
> +class ContractType(orm.Model):
> _inherit = 'contract.type'
>
> _columns = {
> @@ -33,75 +34,85 @@
> _defaults = {
> 'permanence_month': 0,
> 'start_billing_days': 4,
> - }
> -
> -contract_type()
> -
> -class contract_unsubscription(osv.osv):
> + }
> +
> +
> +class ContractUnsubscription(orm.Model):
> _name = 'contract.unsubscription'
> _description = 'Reason for Contract Unsubscription'
>
> _columns = {
> 'name': fields.char('Name', size=64, required=True),
> 'description': fields.text('Description'),
> - }
> -
> -contract_unsubscription()
> -
> -
> -class contract_contract(osv.osv):
> + }
> +
> +
> +class ContractContract(orm.Model):
> _inherit = 'contract.contract'
>
> - _columns = {
> + _columns = {
> 'permanence_month': fields.integer('Permanence Months'),
> 'start_billing_days': fields.integer('Start Billing Days'),
> }
> +
> _defaults = {
> 'permanence_month': 0,
> 'start_billing_days': 4,
> - }
> + }
>
> def is_duo(self, contract):
> - return (contract and contract.contract_type_id and contract.contract_type_id.ref == 'Duo' or False)
> + return (contract and contract.contract_type_id and
> + contract.contract_type_id.ref == 'Duo' or False)
>
> - def onchange_contract_type(self, cr, uid, ids, contract_type_id, customer_id=False, elevator_id=False):
> - res = super(contract_contract,self).onchange_contract_type(cr,uid,ids,contract_type_id, customer_id, elevator_id)
> + def onchange_contract_type(self, cr, uid, ids, contract_type_id,
> + customer_id=False, elevator_id=False):
> + res = super(ContractContract,
> + self).onchange_contract_type(cr, uid, ids,
> + contract_type_id, customer_id,
> + elevator_id)
> if not res['value']['sale_type']:
> return res
> - contract_type = self.pool.get('contract.type').browse(cr, uid, contract_type_id)
> + contract_type = self.pool['contract.type'].browse(cr, uid,
> + contract_type_id)
> res['value']['permanence_month'] = contract_type.permanence_month
> res['value']['start_billing_days'] = contract_type.start_billing_days
> return res
>
> -contract_contract()
> -
> -
> -class contract_annexe(osv.osv):
> +
> +class ContractAnnexe(orm.Model):
> _inherit = 'contract.annexe'
>
> _columns = {
> - 'expiration_date' : fields.date('Paid Date'),
> - 'permanence_date' : fields.date('Permanence Date'),
> - 'unsubscription_id': fields.many2one('contract.unsubscription', 'Reason for Unsubscription'),
> + 'expiration_date': fields.date('Paid Date'),
> + 'permanence_date': fields.date('Permanence Date'),
> + 'unsubscription_id': fields.many2one('contract.unsubscription',
> + 'Reason for Unsubscription'),
> 'unsubscription_details': fields.text('Unsubscription Details'),
> - }
> -
> -
> - def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
> + }
> +
> + def name_search(self, cr, user, name='', args=None, operator='ilike',
> + context=None, limit=100):
> if not args:
> - args=[]
> + args = []
> if name:
> - ids = self.search(cr, user, ['|', ('pack_production_lot_id.name', operator, name), ('pack_production_lot_id.ref', operator, name)] + args, limit=limit, context=context)
> - if not ids:
> - ids = self.search(cr, user, [('production_lot_2_id.name', operator, name)] + args, limit=limit, context=context)
> - if not ids:
> - ids = self.search(cr, user, [('production_lot_id.ref', operator, name)] + args, limit=limit, context=context)
> + ids = self.search(
> + cr, user, (['|', ('pack_production_lot_id.name', operator,
> + name),
> + ('pack_production_lot_id.ref', operator, name)] +
> + args), limit=limit, context=context)
> + if not ids:
> + ids = self.search(
> + cr, user, ([('production_lot_2_id.name', operator, name)] +
> + args), limit=limit, context=context)
> + if not ids:
> + ids = self.search(
> + cr, user, ([('production_lot_id.ref', operator, name)] +
> + args), limit=limit, context=context)
> else:
> ids = self.search(cr, user, args, limit=limit, context=context)
>
> return self.name_get(cr, user, ids, context=context)
>
> -
> def name_get(self, cr, uid, ids, context={}):
> result = []
> for a in self.browse(cr, uid, ids, context):
> @@ -126,82 +137,99 @@
>
> return result
>
> -
> def create(self, cr, uid, vals, context=None):
> if 'contract_id' in vals:
> - contract_permanence = self.pool.get('contract.contract').browse(cr, uid, vals['contract_id'])['permanence_month']
> + contract_obj = self.pool['contract.contract']
> +
> + contract_permanence = contract_obj.browse(
> + cr, uid, vals['contract_id'],
> + context=context)['permanence_month']
> if 'permanence_date' in vals and vals['permanence_date']:
> - return super(contract_annexe, self).create(cr, uid, vals, context=context)
> + return super(ContractAnnexe,
> + self).create(cr, uid, vals, context=context)
> if contract_permanence < 0:
> - permanence_date = datetime.strptime(vals['annexe_date'], '%Y-%m-%d')
> + permanence_date = datetime.strptime(vals['annexe_date'],
> + '%Y-%m-%d')
> elif 'start_billing_date' in vals and vals['start_billing_date']:
> - permanence_date = datetime.strptime(vals['start_billing_date'], '%Y-%m-%d') + relativedelta(months=+contract_permanence)
> + permanence_date = (
> + datetime.strptime(vals['start_billing_date'], '%Y-%m-%d') +
> + relativedelta(months=+contract_permanence))
> elif 'annexe_date' in vals and vals['annexe_date']:
> - permanence_date = datetime.strptime(vals['annexe_date'], '%Y-%m-%d') + relativedelta(months=+contract_permanence)
> + permanence_date = (
> + datetime.strptime(vals['annexe_date'], '%Y-%m-%d') +
> + relativedelta(months=+contract_permanence))
> vals['permanence_date'] = permanence_date.strftime('%Y-%m-%d')
> - return super(contract_annexe, self).create(cr, uid, vals, context=context)
> -
> -contract_annexe()
> -
> -
> -class contract_historical(osv.osv):
> + return super(ContractAnnexe,
> + self).create(cr, uid, vals, context=context)
> +
> +
> +class ContractHistorical(orm.Model):
> _inherit = 'contract.historical'
> - _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - 'customer_id': fields.many2one('res.partner', 'Customer', select=True, required=True),
> - }
> -
> -contract_historical()
> -
> -
> -class contract_info_invoice(osv.osv):
> +
> + _columns = {
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + 'customer_id': fields.many2one('res.partner', 'Customer', select=True,
> + required=True),
> + }
> +
> +
> +class ContractInfoInvoice(orm.Model):
> _inherit = 'contract.info.invoice'
> +
> _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_info_invoice()
> -
> -
> -class contract_shipping_cost(osv.osv):
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
> +
> +
> +class ContractShippingCost(orm.Model):
> _inherit = 'contract.shipping.cost'
> - _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_shipping_cost()
> -
> -
> -class contract_price_rules(osv.osv):
> +
> + _columns = {
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
> +
> +
> +class ContractPriceRules(orm.Model):
> _inherit = 'contract.price.rules'
> +
> _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_price_rules()
> -
> -
> -class contract_price(osv.osv):
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
> +
> +
> +class ContractPrice(orm.Model):
> _inherit = 'contract.price'
> +
> _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_price()
> -
> -
> -class contract_scaled_price(osv.osv):
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
> +
> +
> +class ContractScaledPrice(orm.Model):
> _inherit = 'contract.scaled.price'
> +
> _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_scaled_price()
> -
> -class contract_annexe_historical(osv.osv):
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
> +
> +
> +class ContractAnnexeHistorical(orm.Model):
> _inherit = 'contract.annexe.historical'
> +
> _columns = {
> - 'contract_id': fields.many2one('contract.contract', 'Contract', select=True, required=True, ondelete='cascade'),
> - }
> -
> -contract_annexe_historical()
> + 'contract_id': fields.many2one('contract.contract', 'Contract',
> + select=True, required=True,
> + ondelete='cascade'),
> + }
>
> === renamed file 'nayar_dos_contracts/invoice.py' => 'nayar_dos_contracts/models/invoice.py'
> --- nayar_dos_contracts/invoice.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/models/invoice.py 2014-07-07 08:55:17 +0000
> @@ -19,18 +19,18 @@
> #
> ##############################################################################
>
> -from osv import osv, fields
> -
> -class account_invoice_line(osv.osv):
> -
> +from openerp.osv import orm, fields
> +
> +
> +class AccountInvoiceLine(orm.Model):
> _inherit = "account.invoice.line"
>
> _columns = {
> 'product_identifier': fields.char('Identifier', size=30),
> - }
> + }
>
> def _write_product_identifier(self, cr, uid, ids, context=None):
> - product_obj = self.pool.get('product.product')
> + product_obj = self.pool['product.product']
>
> if not type(ids) in (list, tuple):
> ids = [ids]
> @@ -39,25 +39,36 @@
> for line in lines:
> if not line.product_identifier:
> product_identifier = False
> - if line.contract_annexe_id and product_obj._is_sim(line.product_id.categ_id):
> - product_identifier = line.contract_annexe_id.production_lot_id and line.contract_annexe_id.production_lot_id.telefono or ''
> - elif line.contract_annexe_id and product_obj._is_link(line.product_id.categ_id):
> - product_identifier = line.contract_annexe_id.production_lot_2_id and line.contract_annexe_id.production_lot_2_id.imei or ''
> + if (line.contract_annexe_id and
> + product_obj._is_sim(line.product_id.categ_id)):
> + product_identifier = (
> + line.contract_annexe_id.production_lot_id and
> + line.contract_annexe_id.production_lot_id.telefono or
> + '')
> + elif (line.contract_annexe_id and
> + product_obj._is_link(line.product_id.categ_id)):
> + product_identifier = (
> + line.contract_annexe_id.production_lot_2_id and
> + line.contract_annexe_id.production_lot_2_id.imei or '')
> elif line.stock_move_id:
> - product_identifier = line.stock_move_id.prodlot_id and (line.stock_move_id.prodlot_id.ref or line.stock_move_id.prodlot_id.name) or ''
> + product_identifier = (line.stock_move_id.prodlot_id and
> + (line.stock_move_id.prodlot_id.ref or
> + line.stock_move_id.prodlot_id.name)
> + or '')
>
> if product_identifier:
> - self.write(cr, uid, [line.id], {'product_identifier': product_identifier})
> + self.write(cr, uid, [line.id],
> + {'product_identifier': product_identifier},
> + context=context)
>
> def create(self, cr, uid, vals, context=None):
> - ids = super(account_invoice_line, self).create(cr, uid, vals, context=context)
> + ids = super(AccountInvoiceLine,
> + self).create(cr, uid, vals, context=context)
> self._write_product_identifier(cr, uid, ids, context=context)
> return ids
>
> def write(self, cr, uid, ids, vals, context=None):
> - res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=None)
> + res = super(AccountInvoiceLine,
> + self).write(cr, uid, ids, vals, context=context)
> self._write_product_identifier(cr, uid, ids, context=context)
> return res
> -
> -account_invoice_line()
> -
>
> === renamed file 'nayar_dos_contracts/partner.py' => 'nayar_dos_contracts/models/partner.py'
No has adaptado a v7 este archivo.
> === renamed file 'nayar_dos_contracts/sale.py' => 'nayar_dos_contracts/models/sale.py'
> --- nayar_dos_contracts/sale.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/models/sale.py 2014-07-07 08:55:17 +0000
> @@ -19,46 +19,54 @@
> #
> ##############################################################################
>
> -from osv import osv, fields
> -
> -class sale_order(osv.osv):
> - _inherit ="sale.order"
> -
> - def _get_shipping_state_id(self, cr, uid, ids, field_name, arg, context=None):
> - res = {}
> - for id in ids:
> - order = self.browse(cr, uid, id)
> - res[id] = (order and order.partner_shipping_id and order.partner_shipping_id.state_id and order.partner_shipping_id.state_id.id) or False
> -
> - return res
> -
> +from openerp.osv import orm, fields
> +
> +
> +class SaleOrder(orm.Model):
> + _inherit = "sale.order"
>
> _columns = {
> - 'shipping_state_id': fields.function(_get_shipping_state_id, method=True, type="many2one", obj="res.country.state", string="Fed. State"),
> - }
> -
> - def _get_bom_product_lot(self, cr, uid, warehouse, prodlot_id, product_id):
> - product_obj = self.pool.get('product.product')
> - stock_lot_obj = self.pool.get('stock.production.lot')
> -
> - product = product_obj.browse(cr, uid, product_id)
> - stock_lot = stock_lot_obj.browse(cr, uid, prodlot_id)
> + 'shipping_state_id': fields.related('partner_shipping_id',
> + 'state_id',
> + type="many2one",
> + relation="res.country.state",
> + string="Fed. State"),
> + }
> +
> + def _get_bom_product_lot(self, cr, uid, warehouse, prodlot_id, product_id,
> + context=None):
> + product_obj = self.pool['product.product']
> + stock_lot_obj = self.pool['stock.production.lot']
> +
> + product = product_obj.browse(cr, uid, product_id, context=context)
> + stock_lot = stock_lot_obj.browse(cr, uid, prodlot_id, context=context)
> if product_obj._is_sim(product.categ_id):
> - return stock_lot_obj.search(cr, uid, [('name', '=', stock_lot.icc), ('product_id', '=', product_id)])[0]
> + return stock_lot_obj.search(cr, uid,
> + [('name', '=', stock_lot.icc),
> + ('product_id', '=', product_id)],
> + context=context)[0]
> elif product_obj._is_link(product.categ_id):
> - return stock_lot_obj.search(cr, uid, [('name', '=', stock_lot.imei), ('product_id', '=', product_id)])[0]
> + return stock_lot_obj.search(cr, uid,
> + [('name', '=', stock_lot.imei),
> + ('product_id', '=', product_id)],
> + context=context)[0]
> else:
> return False
>
> - def _get_bom_stock_location_dest(self, cr, uid, warehouse, prodlot_id, product_id):
> + def _get_bom_stock_location_dest(
> + self, cr, uid, warehouse, prodlot_id, product_id):
> # Devuelve la localización de stock de Producción
> return 7
>
> - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
> + def fields_view_get(self, cr, uid, view_id=None, view_type='form',
> + context=None, toolbar=False, submenu=False):
> # Muestra los pedidos no procesados en rojo
> - result = super(osv.osv, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
> + result = super(orm.Model,
> + self).fields_view_get(cr, uid, view_id=view_id,
> + view_type=view_type,
> + context=context, toolbar=toolbar,
> + submenu=submenu)
> if view_type == 'tree' and 'arch' in result:
> - result['arch'] = result['arch'].replace("red:state in (", "red:state in ('draft',", 1)
> + result['arch'] = result['arch'].replace(
> + "red:state in (", "red:state in ('draft',", 1)
> return result
> -
> -sale_order()
>
> === renamed file 'nayar_dos_contracts/stock.py' => 'nayar_dos_contracts/models/stock.py'
> --- nayar_dos_contracts/stock.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/models/stock.py 2014-07-07 08:55:17 +0000
> @@ -19,27 +19,31 @@
> #
> ##############################################################################
>
> -from osv import osv
> -
> -class stock_picking(osv.osv):
> +from openerp.osv import orm
> +
> +
> +class StockPicking(orm.Model):
> _inherit = "stock.picking"
>
> def _invoice_line_hook(self, cr, uid, move_line, invoice_line_id):
> - line_obj = self.pool.get('account.invoice.line')
> - contract_obj = self.pool.get('contract.contract')
> - product_obj = self.pool.get('product.product')
> + line_obj = self.pool['account.invoice.line']
> + contract_obj = self.pool['contract.contract']
> + product_obj = self.pool['product.product']
>
> - res = super(stock_picking, self)._invoice_line_hook(cr, uid, move_line, invoice_line_id)
> + res = super(StockPicking,
> + self)._invoice_line_hook(cr, uid, move_line,
> + invoice_line_id)
> if line_obj.search(cr, uid, [('id', '=', invoice_line_id)]):
> line = line_obj.browse(cr, uid, invoice_line_id)
> - if contract_obj.is_duo(line.contract_id) and product_obj._is_link(line.product_id.categ_id) and line.price_subtotal == 0:
> + if (contract_obj.is_duo(line.contract_id) and
> + product_obj._is_link(line.product_id.categ_id) and
> + line.price_subtotal == 0):
> line_obj.unlink(cr, uid, line.id)
> return res
>
> def _get_start_billing_days(self, cr, uid, move_line):
> if move_line.picking_id.contract_id.start_billing_days is None:
> - return super(stock_picking, self)._get_start_billing_days(cr, uid, move_line)
> + return super(StockPicking,
> + self)._get_start_billing_days(cr, uid, move_line)
> else:
> return move_line.picking_id.contract_id.start_billing_days
> -
> -stock_picking()
>
> === renamed file 'nayar_dos_contracts/template.py' => 'nayar_dos_contracts/models/template.py'
> --- nayar_dos_contracts/template.py 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/models/template.py 2014-07-07 08:55:17 +0000
> @@ -19,35 +19,52 @@
> #
> ##############################################################################
>
> -from osv import osv, fields
> -from tools.translate import _
> -
> -
> -class contract_template(osv.osv):
> +from openerp.osv import orm, fields
> +from openerp.tools.translate import _
> +
> +
> +class ContractTemplate(orm.Model):
> _name = 'contract.template'
> _description = 'Contract Template'
>
> _columns = {
> 'name': fields.char('Name', size=256, required=True),
> - 'partner_id': fields.many2one('res.partner', 'Elevator', required=True),
> - 'contract_type_id': fields.many2one('contract.type', 'Contract Type', select=True),
> - 'fixed_price': fields.float('Fixed Price', digits=(2,2)),
> - 'differential_price': fields.float('Differential Price', digits=(2,2)),
> - 'extra_cabin_price': fields.float('Extra Cabin Price', digits=(2,2)),
> - 'fixed_commission': fields.float('Fixed Commission', digits=(2,2)),
> - 'differential_commission': fields.float('Differential Commission', digits=(2,2)),
> - 'fixed_link_price': fields.float('Fixed Link Price', digits=(2,2)),
> - 'differential_link_price': fields.float('Differential Link Price', digits=(2,2)),
> + 'partner_id': fields.many2one('res.partner', 'Elevator',
> + required=True),
> + 'contract_type_id': fields.many2one('contract.type', 'Contract Type',
> + select=True),
> + 'fixed_price': fields.float('Fixed Price', digits=(2, 2)),
> + 'differential_price': fields.float('Differential Price',
> + digits=(2, 2)),
> + 'extra_cabin_price': fields.float('Extra Cabin Price', digits=(2, 2)),
> + 'fixed_commission': fields.float('Fixed Commission', digits=(2, 2)),
> + 'differential_commission': fields.float('Differential Commission',
> + digits=(2, 2)),
> + 'fixed_link_price': fields.float('Fixed Link Price', digits=(2, 2)),
> + 'differential_link_price': fields.float('Differential Link Price',
> + digits=(2, 2)),
> 'comments': fields.text('Comments'),
> - 'contract_shipping_cost_ids': fields.one2many('contract.template.shipping.cost', 'contract_template_id', 'Shipping Costs'),
> - 'contract_template_price_rules_ids': fields.one2many('contract.template.price.rules', 'contract_template_id', 'Template Prices Rules'),
> - 'info_invoice_ids': fields.one2many('contract.template.info.invoice', 'contract_template_id', 'Invoice information'),
> - 'sale_group_sim_id': fields.many2one('sale.group', 'SIM Sale Group', help="Group sales by default for SIM type products."),
> - 'sale_group_link_id': fields.many2one('sale.group', 'Link Sale Group', help="Group sales by default for Link type products."),
> - 'sale_group_pack_id': fields.many2one('sale.group', 'Pack Sale Group', help="Group sales by default for Pack type products."),
> + 'contract_shipping_cost_ids':
> + fields.one2many('contract.template.shipping.cost',
Pon mejor:
'contract_shipping_cost_ids': fields.one2many(
> + 'contract_template_id', 'Shipping Costs'),
> + 'contract_template_price_rules_ids':
> + fields.one2many('contract.template.price.rules',
Ídem
> + 'contract_template_id', 'Template Prices Rules'),
> + 'info_invoice_ids': fields.one2many('contract.template.info.invoice',
> + 'contract_template_id',
> + 'Invoice information'),
> + 'sale_group_sim_id': fields.many2one('sale.group', 'SIM Sale Group',
> + help="Group sales by default for"
> + " SIM type products."),
> + 'sale_group_link_id': fields.many2one('sale.group', 'Link Sale Group',
> + help="Group sales by default for"
> + " Link type products."),
> + 'sale_group_pack_id': fields.many2one('sale.group', 'Pack Sale Group',
> + help="Group sales by default for"
> + " Pack type products."),
> 'permanence_month': fields.integer('Permanence Months'),
> 'start_billing_days': fields.integer('Start Billing Days'),
> - }
> + }
>
> _defaults = {
> 'fixed_price': 0,
> @@ -57,107 +74,144 @@
> 'differential_commission': 0,
> 'fixed_link_price': 0,
> 'differential_link_price': 0,
> - 'contract_shipping_cost_ids': lambda *a: [{'min_units': 1, 'max_units': 5, 'price': 10}],
> + 'contract_shipping_cost_ids': lambda *a: [{'min_units': 1,
> + 'max_units': 5,
> + 'price': 10}],
> 'start_billing_days': 4,
> - }
> -
> -contract_template()
> -
> -
> -class contract_template_shipping_cost(osv.osv):
> + }
> +
> +
> +class ContractTemplateShippingCost(orm.Model):
> _name = 'contract.template.shipping.cost'
> _description = "Contract Template Shipping Cost"
>
> _columns = {
> - 'min_units' : fields.integer('From', help="Minimum number of units."),
> - 'max_units' : fields.integer('To', help="Maximum number of units."),
> - 'price': fields.float('Price', digits=(2,2)),
> - 'contract_template_id': fields.many2one('contract.template', 'Contract Template', select=True, required=True),
> + 'min_units': fields.integer('From', help="Minimum number of units."),
> + 'max_units': fields.integer('To', help="Maximum number of units."),
> + 'price': fields.float('Price', digits=(2, 2)),
> + 'contract_template_id': fields.many2one('contract.template',
> + 'Contract Template',
> + select=True, required=True),
> }
>
> _order = 'min_units asc'
>
> -
> def create(self, cr, uid, vals, context=None):
>
> if 'min_units' in vals.keys() and vals['min_units'] <= 0:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('The minimum units can not be less than or equal to zero !'))
> + raise orm.except_orm(
Poner esto como constraint a nivel de modelo
> + _('Shipping Cost Error !'),
> + _('The minimum units can not be less than or equal to zero !'))
>
> if 'max_units' in vals.keys() and vals['max_units'] <= 0:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('The maximum units can not be less than or equal to zero !'))
> + raise orm.except_orm(
Poner también como constraint
> + _('Shipping Cost Error !'),
> + _('The maximum units can not be less than or equal to zero !'))
>
> if vals['min_units'] > vals['max_units']:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('You must enter a correct range of units !'))
> -
> - if 'contract_template_id' in vals.keys() and vals['contract_template_id']:
> - shipping_cost_ids = self.search(cr, uid, [('contract_template_id', '=', vals['contract_template_id'])])
> - for shipping_cost in self.browse(cr, uid, shipping_cost_ids, context=context):
> - if (shipping_cost.min_units <= vals['min_units'] and vals['min_units'] <= shipping_cost.max_units) or (shipping_cost.min_units <= vals['max_units'] and vals['max_units'] <= shipping_cost.max_units):
> - raise osv.except_osv(_('Shipping Cost Error !'), _('It is necessary that the shipping cost rules do not produce intersection between them !'))
> -
> - return super(contract_template_shipping_cost, self).create(cr, uid, vals, context=context)
> -
> + raise orm.except_orm(
Poner también como constraint
> + _('Shipping Cost Error !'),
> + _('You must enter a correct range of units !'))
> +
> + if 'contract_template_id' in vals and vals['contract_template_id']:
> + shipping_cost_ids = self.search(
> + cr, uid, [('contract_template_id', '=',
> + vals['contract_template_id'])])
> + for shipping_cost in self.browse(cr, uid, shipping_cost_ids,
> + context=context):
> + if ((shipping_cost.min_units <= vals['min_units'] and
> + vals['min_units'] <= shipping_cost.max_units) or
> + (shipping_cost.min_units <= vals['max_units'] and
> + vals['max_units'] <= shipping_cost.max_units)):
> + raise orm.except_orm(
> + _('Shipping Cost Error !'),
> + _('It is necessary that the shipping cost rules do not'
> + ' produce intersection between them !'))
> +
> + return super(ContractTemplateShippingCost,
> + self).create(cr, uid, vals, context=context)
>
> def write(self, cr, uid, ids, vals, context=None):
> -
> - if 'min_units' in vals.keys() and vals['min_units'] <= 0:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('The minimum units can not be less than or equal to zero !'))
> -
> - if 'max_units' in vals.keys() and vals['max_units'] <= 0:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('The maximum units can not be less than or equal to zero !'))
> + if 'min_units' in vals and vals['min_units'] <= 0:
Este método ya no sería necesario si se pone como constraint
> + raise orm.except_orm(
> + _('Shipping Cost Error !'),
> + _('The minimum units can not be less than or equal to zero !'))
> +
> + if 'max_units' in vals and vals['max_units'] <= 0:
> + raise orm.except_orm(
> + _('Shipping Cost Error !'),
> + _('The maximum units can not be less than or equal to zero !'))
>
> if vals['min_units'] > vals['max_units']:
> - raise osv.except_osv(_('Shipping Cost Error !'), _('You must enter a correct range of units !'))
> + raise orm.except_orm(
> + _('Shipping Cost Error !'),
> + _('You must enter a correct range of units !'))
>
> for shipping_cost in self.browse(cr, uid, ids, context=context):
> - shipping_cost_ids = self.search(cr, uid, [('contract_template_id', '=', shipping_cost.contract_id.id), ('id', '!=', shipping_cost.id)])
> - for shipping_cost_2 in self.browse(cr, uid, shipping_cost_ids, context=context):
> - if (shipping_cost_2.min_units <= vals['min_units'] and vals['min_units'] <= shipping_cost_2.max_units) or (shipping_cost_2.min_units <= vals['max_units'] and vals['max_units'] <= shipping_cost_2.max_units):
> - raise osv.except_osv(_('Shipping Cost Error !'), _('It is necessary that the shipping cost rules do not produce intersection between them !'))
> -
> - return super(contract_template_shipping_cost, self).write(cr, uid, ids, vals, context = context)
> -
> -
> -contract_template_shipping_cost()
> -
> -
> -class contract_template_info_invoice(osv.osv):
> -
> + shipping_cost_ids = self.search(
> + cr, uid,
> + [('contract_template_id', '=', shipping_cost.contract_id.id),
> + ('id', '!=', shipping_cost.id)])
> + for shipping_cost_2 in self.browse(cr, uid, shipping_cost_ids,
> + context=context):
> + if ((shipping_cost_2.min_units <= vals['min_units'] and
> + vals['min_units'] <= shipping_cost_2.max_units) or
> + (shipping_cost_2.min_units <= vals['max_units'] and
> + vals['max_units'] <= shipping_cost_2.max_units)):
> + raise orm.except_orm(
> + _('Shipping Cost Error !'),
> + _('It is necessary that the shipping cost rules do not'
> + ' produce intersection between them !'))
> +
> + return super(ContractTemplateShippingCost,
> + self).write(cr, uid, ids, vals, context=context)
> +
> +
> +class ContractTemplateInfoInvoice(orm.Model):
> _name = 'contract.template.info.invoice'
>
> _columns = {
> - 'contract_template_id': fields.many2one('contract.template', 'Contract Template', select=True, required=True),
> - 'categ_id' : fields.many2one('product.category', 'Product Category', select=True, required=True),
> - 'receiver' : fields.selection([('cliente', 'Cliente'), ('ascensorista', 'Ascensorista')], 'Receiver', select=True, required=True),
> + 'contract_template_id': fields.many2one('contract.template',
> + 'Contract Template',
> + select=True, required=True),
> + 'categ_id': fields.many2one('product.category', 'Product Category',
> + select=True, required=True),
> + 'receiver': fields.selection([('cliente', 'Cliente'),
> + ('ascensorista', 'Ascensorista')],
> + 'Receiver', select=True, required=True),
> }
>
> _sql_constraints = [
> - ('categ_uniq', 'unique(contract_id, categ_id)', 'Product Category must be unique !'),
> + ('categ_uniq', 'unique(contract_id, categ_id)',
> + 'Product Category must be unique !'),
> ]
>
> -contract_template_info_invoice()
> -
> -
> -class contract_template_price_rules(osv.osv):
> -
> +
> +class ContractTemplatePriceRules(orm.Model):
> _name = 'contract.template.price.rules'
> -
> +
> _columns = {
> - 'contract_template_id': fields.many2one('contract.template', 'Contract Template', select=True, required=True),
> - 'product_id': fields.many2one('product.product', 'SIM Product', select=True),
> - 'product_2_id': fields.many2one('product.product', 'Link Product', select=True),
> - 'fixed_price': fields.float('Fixed Price', digits=(2,2)),
> - 'differential_price': fields.float('Differential Price', digits=(2,2)),
> - 'extra_cabin_price': fields.float('Extra Cabin Price', digits=(2,2)),
> - 'fixed_link_price': fields.float('Fixed Link Price', digits=(2,2)),
> - 'differential_link_price': fields.float('Differential Link Price', digits=(2,2)),
> - 'fixed_commission': fields.float('Fixed Commission', digits=(2,2)),
> - 'differential_commission': fields.float('Differential Commission', digits=(2,2)),
> + 'contract_template_id': fields.many2one('contract.template',
> + 'Contract Template',
> + select=True, required=True),
> + 'product_id': fields.many2one('product.product', 'SIM Product',
> + select=True),
> + 'product_2_id': fields.many2one('product.product', 'Link Product',
> + select=True),
> + 'fixed_price': fields.float('Fixed Price', digits=(2, 2)),
> + 'differential_price': fields.float('Differential Price',
> + digits=(2, 2)),
> + 'extra_cabin_price': fields.float('Extra Cabin Price', digits=(2, 2)),
> + 'fixed_link_price': fields.float('Fixed Link Price', digits=(2, 2)),
> + 'differential_link_price': fields.float('Differential Link Price',
> + digits=(2, 2)),
> + 'fixed_commission': fields.float('Fixed Commission', digits=(2, 2)),
> + 'differential_commission': fields.float('Differential Commission',
> + digits=(2, 2)),
> }
> -
> +
> _sql_constraints = [
> - ('contract_template_price_rules_uniq', 'unique(contract_template_id, product_id, product_2_id)', 'Can not define price rules for the same SIM and/or link !'),
> + ('contract_template_price_rules_uniq',
> + 'unique(contract_template_id, product_id, product_2_id)',
> + 'Can not define price rules for the same SIM and/or link !'),
> ]
> -
> -contract_template_price_rules()
> -
>
> === added directory 'nayar_dos_contracts/views'
> === renamed file 'nayar_dos_contracts/contract_view.xml' => 'nayar_dos_contracts/views/contract_view.xml'
> --- nayar_dos_contracts/contract_view.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/views/contract_view.xml 2014-07-07 08:55:17 +0000
> @@ -1,124 +1,125 @@
> <?xml version="1.0" encoding="utf-8"?>
> <openerp>
> - <data>
> - <record model="ir.ui.view" id="view_contract_type_permanence_tree">
> - <field name="name">view.contract.type.permanence.tree</field>
> - <field name="model">contract.type</field>
> - <field name="inherit_id" ref="dos_contracts.view_contract_type_tree"/>
> - <field name="type">tree</field>
> - <field name="arch" type="xml">
> - <field name="sale_type" position="after">
> - <field name="permanence_month"/>
> - <field name="start_billing_days"/>
> - </field>
> - </field>
> - </record>
> -
> - <record model="ir.ui.view" id="view_contract_type_permancence_form">
> - <field name="name">view.contract.type.permancence.form</field>
> - <field name="model">contract.type</field>
> - <field name="inherit_id" ref="dos_contracts.view_contract_type_form"/>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <field name="fixed_commission" position="after">
> - <separator string="Permanence" colspan="4" col="4" />
> - <field name="permanence_month"/>
> - <field name="start_billing_days"/>
> - </field>
> - </field>
> - </record>
> -
> - <record model="ir.ui.view" id="view_contract_permancence_form">
> - <field name="name">view.contract.permancence.form</field>
> - <field name="model">contract.contract</field>
> - <field name="inherit_id" ref="dos_contracts.view_contract_form"/>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <field name="fixed_commission" position="after">
> - <separator string="Permanence" colspan="4" col="4" />
> - <field name="permanence_month"/>
> - <field name="start_billing_days"/>
> - </field>
> - </field>
> - </record>
> -
> - <record model="ir.ui.view" id="view_contract_annexe_form">
> - <field name="name">view.contract.annexe.form</field>
> - <field name="model">contract.annexe</field>
> - <field name="inherit_id" ref="dos_contracts.view_contract_annexe_form"/>
> - <field name="priority">1</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <field name="expiration_date" position="after">
> - <field name="permanence_date" />
> - </field>
> - <page string="Other Information" position="replace">
> - <page string="Other Information">
> - <group colspan="2" col="2">
> - <separator string="Reason for Unsubscription"/>
> - <field name="unsubscription_id"/>
> - <field name="unsubscription_details" nolabel="1" colspan="2"/>
> - <separator string="Comments"/>
> - <field name="comments" nolabel="1" colspan="2"/>
> - </group>
> - </page>
> - </page>
> - </field>
> - </record>
> -
> - <!-- Unsubscription Search View -->
> - <record id="view_contract_unsubscription_search" model="ir.ui.view">
> - <field name="name">view.contract.unsubscription.search</field>
> - <field name="model">contract.unsubscription</field>
> - <field name="type">search</field>
> - <field name="arch" type="xml">
> - <search string="Search Reasons for Unsubscription">
> - <field name="name"/>
> - <field name="description"/>
> - </search>
> - </field>
> - </record>
> -
> - <!-- Contract Unsubscription Tree View-->
> - <record id="view_contract_unsubscription_tree" model="ir.ui.view">
> - <field name="name">view.contract.unsubscription.tree</field>
> - <field name="model">contract.unsubscription</field>
> - <field name="type">tree</field>
> - <field name="priority">1</field>
> - <field name="arch" type="xml">
> - <tree string="Reasons for Unsubscription">
> - <field name="name"/>
> - <field name="description"/>
> - </tree>
> - </field>
> - </record>
> -
> - <!-- Contract Unsubscription Form View -->
> - <record id="view_contract_unsubscription_form" model="ir.ui.view" >
> - <field name="name">view.contract.unsubscription.form</field>
> - <field name="model">contract.unsubscription</field>
> - <field name="priority">1</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <form string="Reason for Unsubscription">
> - <group colspan="2" col="2">
> - <field name="name"/>
> - <field name="description"/>
> - </group>
> - </form>
> - </field>
> - </record>
> -
> - <record id="action_contract_unsubscription_form" model="ir.actions.act_window">
> - <field name="name">Reasons for Unsubscription</field>
> - <field name="type">ir.actions.act_window</field>
> - <field name="res_model">contract.unsubscription</field>
> - <field name="view_type">form</field>
> - <field name="view_mode">tree,form</field>
> - <field name="search_view_id" ref="view_contract_unsubscription_search"/>
> - </record>
> -
> - <menuitem action="action_contract_unsubscription_form" id="menu_contract_unsubscription" parent="base.menu_contracts" sequence="1"/>
> -
> - </data>
> + <data>
> + <record model="ir.ui.view" id="view_contract_type_permanence_tree">
> + <field name="name">view.contract.type.permanence.tree</field>
> + <field name="model">contract.type</field>
> + <field name="inherit_id" ref="dos_contracts.view_contract_type_tree" />
> + <field name="arch" type="xml">
> + <field name="sale_type" position="after">
> + <field name="permanence_month" />
> + <field name="start_billing_days" />
> + </field>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="view_contract_type_permancence_form">
> + <field name="name">view.contract.type.permancence.form
> + </field>
> + <field name="model">contract.type</field>
> + <field name="inherit_id" ref="dos_contracts.view_contract_type_form" />
> + <field name="arch" type="xml">
> + <field name="fixed_commission" position="after">
> + <separator string="Permanence" colspan="4"
> + col="4" />
> + <field name="permanence_month" />
> + <field name="start_billing_days" />
> + </field>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="view_contract_permancence_form">
> + <field name="name">view.contract.permancence.form</field>
> + <field name="model">contract.contract</field>
> + <field name="inherit_id" ref="dos_contracts.view_contract_form" />
> + <field name="arch" type="xml">
> + <field name="fixed_commission" position="after">
> + <separator string="Permanence" colspan="4"
> + col="4" />
> + <field name="permanence_month" />
> + <field name="start_billing_days" />
> + </field>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="view_contract_annexe_form">
> + <field name="name">view.contract.annexe.form</field>
> + <field name="model">contract.annexe</field>
> + <field name="inherit_id" ref="dos_contracts.view_contract_annexe_form" />
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <field name="expiration_date" position="after">
> + <field name="permanence_date" />
> + </field>
> + <page string="Other Information" position="replace">
¿Se puede hacer sin replace?
> + <page string="Other Information">
> + <group colspan="2" col="2">
> + <separator string="Reason for Unsubscription" />
> + <field name="unsubscription_id" />
> + <field name="unsubscription_details"
> + nolabel="1" colspan="2" />
> + <separator string="Comments" />
> + <field name="comments" nolabel="1"
> + colspan="2" />
> + </group>
> + </page>
> + </page>
> + </field>
> + </record>
> +
> + <!-- Unsubscription Search View -->
> + <record id="view_contract_unsubscription_search" model="ir.ui.view">
> + <field name="name">view.contract.unsubscription.search
> + </field>
> + <field name="model">contract.unsubscription</field>
> + <field name="arch" type="xml">
> + <search string="Search Reasons for Unsubscription">
> + <field name="name" />
> + <field name="description" />
> + </search>
> + </field>
> + </record>
> +
> + <!-- Contract Unsubscription Tree View -->
> + <record id="view_contract_unsubscription_tree" model="ir.ui.view">
> + <field name="name">view.contract.unsubscription.tree</field>
> + <field name="model">contract.unsubscription</field>
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <tree string="Reasons for Unsubscription">
> + <field name="name" />
> + <field name="description" />
> + </tree>
> + </field>
> + </record>
> +
> + <!-- Contract Unsubscription Form View -->
> + <record id="view_contract_unsubscription_form" model="ir.ui.view">
> + <field name="name">view.contract.unsubscription.form</field>
> + <field name="model">contract.unsubscription</field>
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <form string="Reason for Unsubscription">
> + <group colspan="2" col="2">
> + <field name="name" />
> + <field name="description" />
> + </group>
> + </form>
> + </field>
> + </record>
> +
> + <record id="action_contract_unsubscription_form" model="ir.actions.act_window">
> + <field name="name">Reasons for Unsubscription</field>
> + <field name="type">ir.actions.act_window</field>
> + <field name="res_model">contract.unsubscription</field>
> + <field name="view_type">form</field>
> + <field name="view_mode">tree,form</field>
> + <field name="search_view_id" ref="view_contract_unsubscription_search" />
> + </record>
> +
> + <menuitem action="action_contract_unsubscription_form"
> + id="menu_contract_unsubscription" parent="base.menu_contracts"
> + sequence="1" />
> +
> + </data>
> </openerp>
>
> === renamed file 'nayar_dos_contracts/invoice_view.xml' => 'nayar_dos_contracts/views/invoice_view.xml'
> --- nayar_dos_contracts/invoice_view.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/views/invoice_view.xml 2014-07-07 08:55:17 +0000
> @@ -1,18 +1,17 @@
> <?xml version="1.0"?>
> <openerp>
> - <data>
> - <record id="view_invoice_line_inherit_form" model="ir.ui.view">
> - <field name="name">invoice.line.inherit.form</field>
> - <field name="model">account.invoice.line</field>
> - <field name="inherit_id" ref="account.view_invoice_line_form"/>
> - <field name="type">form</field>
> - <field name="priority">1</field>
> - <field name="arch" type="xml">
> - <field name="name" position="replace">
> - <field name="name"/>
> - <field name="product_identifier"/>
> - </field>
> - </field>
> - </record>
> - </data>
> + <data>
> + <record id="view_invoice_line_inherit_form" model="ir.ui.view">
> + <field name="name">invoice.line.inherit.form</field>
> + <field name="model">account.invoice.line</field>
> + <field name="inherit_id" ref="account.view_invoice_line_form" />
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <field name="name" position="replace">
Mejor poner position="after" y no volver a poner el campo name. A lo mejor hacen esto porque dispara un onchange el estándar y no quieren eso. Revísalo por si acaso, y si es así, hazlo con position="attributes".
> + <field name="name" />
> + <field name="product_identifier" />
> + </field>
> + </field>
> + </record>
> + </data>
> </openerp>
>
> === renamed file 'nayar_dos_contracts/partner_view.xml' => 'nayar_dos_contracts/views/partner_view.xml'
> --- nayar_dos_contracts/partner_view.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/views/partner_view.xml 2014-07-07 08:55:17 +0000
> @@ -1,41 +1,39 @@
> <?xml version="1.0" encoding="utf-8"?>
> <openerp>
> - <data>
> - <record model="ir.ui.view" id="view_partner_contract_template_form">
> - <field name="name">res.partner.contract.template.form</field>
> - <field name="model">res.partner</field>
> - <field name="inherit_id" ref="base.view_partner_form"/>
> - <field name="priority">1</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <page string="Notes" position="after">
> - <page string="Contract Templates">
> - <field name="contract_template_ids" nolabel="1" />
> - </page>
> - </page>
> - </field>
> - </record>
> -
> - <record model="ir.ui.view" id="view_partner_state_tree">
> - <field name="name">res.partner.state.tree</field>
> - <field name="model">res.partner</field>
> - <field name="inherit_id" ref="base.view_partner_tree" />
> - <field name="type">tree</field>
> - <field name="arch" type="xml">
> - <field name="city" position="after">
> - <field name="state" />
> - </field>
> - </field>
> - </record>
> -
> - <record model="ir.ui.view" id="view_partner_no_section_tree">
> - <field name="name">res.partner.no.section.tree</field>
> - <field name="model">res.partner</field>
> - <field name="inherit_id" ref="crm.view_partners_tree_crm2" />
> - <field name="type">tree</field>
> - <field name="arch" type="xml">
> - <field name="section_id" position="replace"></field>
> - </field>
> - </record>
> - </data>
> + <data>
> + <record model="ir.ui.view" id="view_partner_contract_template_form">
> + <field name="name">res.partner.contract.template.form</field>
> + <field name="model">res.partner</field>
> + <field name="inherit_id" ref="base.view_partner_form" />
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <page string="Notes" position="after">
> + <page string="Contract Templates">
> + <field name="contract_template_ids"
> + nolabel="1" />
> + </page>
> + </page>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="view_partner_state_tree">
> + <field name="name">res.partner.state.tree</field>
> + <field name="model">res.partner</field>
> + <field name="inherit_id" ref="base.view_partner_tree" />
> + <field name="arch" type="xml">
> + <field name="city" position="after">
> + <field name="state" />
> + </field>
> + </field>
> + </record>
> +
> + <record model="ir.ui.view" id="view_partner_no_section_tree">
> + <field name="name">res.partner.no.section.tree</field>
> + <field name="model">res.partner</field>
> + <field name="inherit_id" ref="crm.view_partners_tree_crm2" />
> + <field name="arch" type="xml">
> + <field name="section_id" position="replace"></field>
Mejor atributo invisible.
> + </field>
> + </record>
> + </data>
> </openerp>
>
> === renamed file 'nayar_dos_contracts/sale_view.xml' => 'nayar_dos_contracts/views/sale_view.xml'
> --- nayar_dos_contracts/sale_view.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/views/sale_view.xml 2014-07-07 08:55:17 +0000
> @@ -1,19 +1,18 @@
> <?xml version="1.0" encoding="utf-8"?>
> <openerp>
> - <data>
> - <record model="ir.ui.view" id="view_order_tree">
> - <field name="name">sale.order.tree</field>
> - <field name="model">sale.order</field>
> - <field name="inherit_id" ref="sale.view_order_tree" />
> - <field name="type">tree</field>
> - <field name="priority">2</field>
> - <field name="arch" type="xml">
> - <field name="client_order_ref" position="replace" />
> - <field name="user_id" position="replace">
> - <field name="shipping_state_id" />
> - <field name="partner_shipping_id" />
> - </field>
> - </field>
> - </record>
> - </data>
> + <data>
> + <record model="ir.ui.view" id="view_order_tree">
> + <field name="name">sale.order.tree</field>
> + <field name="model">sale.order</field>
> + <field name="inherit_id" ref="sale.view_order_tree" />
> + <field name="priority">2</field>
> + <field name="arch" type="xml">
> + <field name="client_order_ref" position="replace" />
Atributo invisible.
> + <field name="user_id" position="replace">
Atributo invisible.
> + <field name="shipping_state_id" />
> + <field name="partner_shipping_id" />
> + </field>
> + </field>
> + </record>
> + </data>
> </openerp>
>
> === renamed file 'nayar_dos_contracts/template_view.xml' => 'nayar_dos_contracts/views/template_view.xml'
> --- nayar_dos_contracts/template_view.xml 2014-06-11 10:23:47 +0000
> +++ nayar_dos_contracts/views/template_view.xml 2014-07-07 08:55:17 +0000
> @@ -1,179 +1,201 @@
> <?xml version="1.0" encoding="utf-8"?>
> <openerp>
> - <data>
> - <!-- Contract Template Tree View -->
> - <record id="view_contract_template_view" model="ir.ui.view">
> - <field name="name">view.contract.template.tree</field>
> - <field name="model">contract.template</field>
> - <field name="type">tree</field>
> - <field name="priority">1</field>
> - <field name="arch" type="xml">
> - <tree string="Contract Templates">
> - <field name="name" />
> - <field name="contract_type_id" />
> - <field name="fixed_price" />
> - <field name="differential_price" />
> - <field name="extra_cabin_price" />
> - <field name="fixed_commission" />
> - <field name="permanence_month"/>
> - <field name="start_billing_days"/>
> - </tree>
> - </field>
> - </record>
> -
> - <!-- Contract Template Form View-->
> - <record id="view_contract_template_form" model="ir.ui.view">
> - <field name="name">view.contract.template.form</field>
> - <field name="model">contract.template</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <form string="Contract Template">
> - <group col="6" colspan="4">
> - <field name="name"/>
> - <newline />
> - <field name="contract_type_id" widget="selection"/>
> - </group>
> - <notebook colspan="5">
> - <page string="Contract Template">
> - <separator string="Sale Groups" colspan="4" col="4" />
> - <field name="sale_group_sim_id" domain="[('type','=','sim')]" />
> - <field name="sale_group_link_id" domain="[('type','=','enlace')]" />
> - <field name="sale_group_pack_id" domain="[('type','=','pack')]" />
> - <separator string="Prices" colspan="4" col="4" />
> - <field name="fixed_price"/>
> - <field name="differential_price"/>
> - <field name="extra_cabin_price"/>
> - <separator string="Link Prices" colspan="4" col="4" />
> - <field name="fixed_link_price"/>
> - <field name="differential_link_price"/>
> - <separator string="Commissions" colspan="4" col="4" />
> - <field name="fixed_commission"/>
> - <separator string="Permanence" colspan="4" col="4" />
> - <field name="permanence_month"/>
> - <field name="start_billing_days"/>
> - </page>
> -
> - <page string="Shipping Costs">
> - <field name="contract_shipping_cost_ids" nolabel="1"/>
> - </page>
> -
> - <page string="Invoice Information">
> - <field name="info_invoice_ids" nolabel="1"/>
> - </page>
> -
> - <page string="Contract Template Prices Rules">
> - <field name="contract_template_price_rules_ids" nolabel="1"/>
> - </page>
> - </notebook>
> - </form>
> - </field>
> - </record>
> -
> - <!-- Contract Template Shipping Costs Tree View-->
> - <record id="view_contract_template_shipping_cost_tree" model="ir.ui.view">
> - <field name="name">view.contract.template.shipping.cost.tree</field>
> - <field name="model">contract.template.shipping.cost</field>
> - <field name="type">tree</field>
> - <field name="priority">1</field>
> - <field name="arch" type="xml">
> - <tree string="Shipping Costs">
> - <field name="min_units"/>
> - <field name="max_units"/>
> - <field name="price"/>
> - </tree>
> - </field>
> - </record>
> -
> - <!-- Contract Template Shipping Costs Form View -->
> - <record id="view_contract_template_shipping_cost_form" model="ir.ui.view" >
> - <field name="name">view.contract.template.shipping.cost.form</field>
> - <field name="model">contract.template.shipping.cost</field>
> - <field name="priority">1</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <form string="Shipping Cost">
> - <group colspan="2" col="4">
> - <separator string="Rule Shipping Cost" colspan="4" col="4" />
> - <field name="min_units"/>
> - <field name="max_units"/>
> - <field name="price"/>
> - </group>
> - </form>
> - </field>
> - </record>
> -
> - <!-- Contract Template Info Invoice Tree View -->
> - <record id="view_contract_template_info_invoice_tree" model="ir.ui.view">
> - <field name="name">view.contract.template.info.invoice.tree</field>
> - <field name="model">contract.template.info.invoice</field>
> - <field name="type">tree</field>
> - <field name="arch" type="xml">
> - <tree string="Invoice Info">
> - <field name="categ_id"/>
> - <field name="receiver"/>
> - </tree>
> - </field>
> - </record>
> -
> - <!-- Contract Info Invoice Form View-->
> - <record id="view_contract_template_info_invoice_form" model="ir.ui.view">
> - <field name="name">view.contract.template.info.invoice.form</field>
> - <field name="model">contract.template.info.invoice</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <form string="Invoice Info">
> - <group colspan="4" col="4">
> - <separator string="Select a product category" colspan="4" />
> - <field name="categ_id" />
> - <separator string="Select a invoice receiver" colspan="4" />
> - <field name="receiver" />
> - </group>
> - </form>
> - </field>
> - </record>
> -
> - <!-- Contract Prices Rules Tree View -->
> - <record id="view_contract_template_price_rules_tree" model="ir.ui.view">
> - <field name="name">view.contract.template.price.rules.tree</field>
> - <field name="model">contract.template.price.rules</field>
> - <field name="type">tree</field>
> - <field name="arch" type="xml">
> - <tree string="Contract Template Prices Rules">
> - <field name="product_id"/>
> - <field name="product_2_id"/>
> - <field name="fixed_price"/>
> - <field name="differential_price"/>
> - <field name="extra_cabin_price"/>
> - <field name="fixed_link_price"/>
> - <field name="differential_link_price"/>
> - <field name="fixed_commission"/>
> - </tree>
> - </field>
> - </record>
> -
> - <!-- Contract Prices Rules Form View-->
> - <record id="view_contract_template_price_rules_form" model="ir.ui.view">
> - <field name="name">view.contract.template.price.rules.form</field>
> - <field name="model">contract.template.price.rules</field>
> - <field name="type">form</field>
> - <field name="arch" type="xml">
> - <form string="Contract Template Prices Rules">
> - <group colspan="4" col="4">
> - <separator string="Information Product" colspan="4" col="4" />
> - <field name="product_id"/>
> - <field name="product_2_id"/>
> - <separator string="Prices" colspan="4" col="4" />
> - <field name="fixed_price" />
> - <field name="differential_price"/>
> - <field name="extra_cabin_price"/>
> - <separator string="Link Prices" colspan="4" col="4" />
> - <field name="fixed_link_price"/>
> - <field name="differential_link_price"/>
> - <separator string="Commissions" colspan="4" col="4" />
> - <field name="fixed_commission"/>
> - </group>
> - </form>
> - </field>
> - </record>
> - </data>
> + <data>
> + <!-- Contract Template Tree View -->
> + <record id="view_contract_template_view" model="ir.ui.view">
> + <field name="name">view.contract.template.tree</field>
> + <field name="model">contract.template</field>
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <tree string="Contract Templates">
> + <field name="name" />
> + <field name="contract_type_id" />
> + <field name="fixed_price" />
> + <field name="differential_price" />
> + <field name="extra_cabin_price" />
> + <field name="fixed_commission" />
> + <field name="permanence_month" />
> + <field name="start_billing_days" />
> + </tree>
> + </field>
> + </record>
> +
> + <!-- Contract Template Form View -->
> + <record id="view_contract_template_form" model="ir.ui.view">
> + <field name="name">view.contract.template.form</field>
> + <field name="model">contract.template</field>
> + <field name="arch" type="xml">
> + <form string="Contract Template">
> + <group col="6" colspan="4">
> + <field name="name" />
> + <newline />
> + <field name="contract_type_id" widget="selection" />
> + </group>
> + <notebook colspan="5">
> + <page string="Contract Template">
> + <separator string="Sale Groups"
> + colspan="4" col="4" />
> + <field name="sale_group_sim_id"
> + domain="[('type','=','sim')]" />
> + <field name="sale_group_link_id"
> + domain="[('type','=','enlace')]" />
> + <field name="sale_group_pack_id"
> + domain="[('type','=','pack')]" />
> + <separator string="Prices"
> + colspan="4" col="4" />
> + <field name="fixed_price" />
> + <field name="differential_price" />
> + <field name="extra_cabin_price" />
> + <separator string="Link Prices"
> + colspan="4" col="4" />
> + <field name="fixed_link_price" />
> + <field name="differential_link_price" />
> + <separator string="Commissions"
> + colspan="4" col="4" />
> + <field name="fixed_commission" />
> + <separator string="Permanence"
> + colspan="4" col="4" />
> + <field name="permanence_month" />
> + <field name="start_billing_days" />
> + </page>
> +
> + <page string="Shipping Costs">
> + <field name="contract_shipping_cost_ids"
> + nolabel="1" />
> + </page>
> +
> + <page string="Invoice Information">
> + <field name="info_invoice_ids"
> + nolabel="1" />
> + </page>
> +
> + <page string="Contract Template Prices Rules">
> + <field name="contract_template_price_rules_ids"
> + nolabel="1" />
> + </page>
> + </notebook>
> + </form>
> + </field>
> + </record>
> +
> + <!-- Contract Template Shipping Costs Tree View -->
> + <record id="view_contract_template_shipping_cost_tree"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.shipping.cost.tree
> + </field>
> + <field name="model">contract.template.shipping.cost</field>
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <tree string="Shipping Costs">
> + <field name="min_units" />
> + <field name="max_units" />
> + <field name="price" />
> + </tree>
> + </field>
> + </record>
> +
> + <!-- Contract Template Shipping Costs Form View -->
> + <record id="view_contract_template_shipping_cost_form"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.shipping.cost.form
> + </field>
> + <field name="model">contract.template.shipping.cost</field>
> + <field name="priority">1</field>
> + <field name="arch" type="xml">
> + <form string="Shipping Cost">
> + <group colspan="2" col="4">
> + <separator string="Rule Shipping Cost"
> + colspan="4" col="4" />
> + <field name="min_units" />
> + <field name="max_units" />
> + <field name="price" />
> + </group>
> + </form>
> + </field>
> + </record>
> +
> + <!-- Contract Template Info Invoice Tree View -->
> + <record id="view_contract_template_info_invoice_tree"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.info.invoice.tree
> + </field>
> + <field name="model">contract.template.info.invoice</field>
> + <field name="arch" type="xml">
> + <tree string="Invoice Info">
> + <field name="categ_id" />
> + <field name="receiver" />
> + </tree>
> + </field>
> + </record>
> +
> + <!-- Contract Info Invoice Form View -->
> + <record id="view_contract_template_info_invoice_form"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.info.invoice.form
> + </field>
> + <field name="model">contract.template.info.invoice</field>
> + <field name="arch" type="xml">
> + <form string="Invoice Info">
> + <group colspan="4" col="4">
> + <separator string="Select a product category"
> + colspan="4" />
> + <field name="categ_id" />
> + <separator string="Select a invoice receiver"
> + colspan="4" />
> + <field name="receiver" />
> + </group>
> + </form>
> + </field>
> + </record>
> +
> + <!-- Contract Prices Rules Tree View -->
> + <record id="view_contract_template_price_rules_tree"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.price.rules.tree
> + </field>
> + <field name="model">contract.template.price.rules</field>
> + <field name="arch" type="xml">
> + <tree string="Contract Template Prices Rules">
> + <field name="product_id" />
> + <field name="product_2_id" />
> + <field name="fixed_price" />
> + <field name="differential_price" />
> + <field name="extra_cabin_price" />
> + <field name="fixed_link_price" />
> + <field name="differential_link_price" />
> + <field name="fixed_commission" />
> + </tree>
> + </field>
> + </record>
> +
> + <!-- Contract Prices Rules Form View -->
> + <record id="view_contract_template_price_rules_form"
> + model="ir.ui.view">
> + <field name="name">view.contract.template.price.rules.form
> + </field>
> + <field name="model">contract.template.price.rules</field>
> + <field name="arch" type="xml">
> + <form string="Contract Template Prices Rules">
> + <group colspan="4" col="4">
> + <separator string="Information Product"
> + colspan="4" col="4" />
> + <field name="product_id" />
> + <field name="product_2_id" />
> + <separator string="Prices" colspan="4"
> + col="4" />
> + <field name="fixed_price" />
> + <field name="differential_price" />
> + <field name="extra_cabin_price" />
> + <separator string="Link Prices"
> + colspan="4" col="4" />
> + <field name="fixed_link_price" />
> + <field name="differential_link_price" />
> + <separator string="Commissions"
> + colspan="4" col="4" />
> + <field name="fixed_commission" />
> + </group>
> + </form>
> + </field>
> + </record>
> + </data>
> </openerp>
>
--
https://code.launchpad.net/~oihanecruce/avanzosc/nayar_dos_contracts/+merge/225508
Your team Avanzosc_security is subscribed to branch lp:~avanzosc-security-team/avanzosc/72horas.
References