瀏覽代碼

Módulo para constructora

sebastian 5 年之前
當前提交
3a447487a1
共有 51 個文件被更改,包括 4182 次插入0 次删除
  1. 5 0
      README.md
  2. 2 0
      __init__.py
  3. 二進制
      __init__.pyc
  4. 36 0
      __openerp__.py
  5. 11 0
      models/__init__.py
  6. 二進制
      models/__init__.pyc
  7. 159 0
      models/construction_account_invoice.py
  8. 二進制
      models/construction_account_invoice.pyc
  9. 52 0
      models/construction_config.py
  10. 二進制
      models/construction_config.pyc
  11. 69 0
      models/construction_expenses_move_line.py
  12. 二進制
      models/construction_expenses_move_line.pyc
  13. 181 0
      models/construction_move.py
  14. 二進制
      models/construction_move.pyc
  15. 226 0
      models/construction_order.py
  16. 二進制
      models/construction_order.pyc
  17. 99 0
      models/construction_order_contractor.py
  18. 二進制
      models/construction_order_contractor.pyc
  19. 140 0
      models/construction_task.py
  20. 二進制
      models/construction_task.pyc
  21. 32 0
      models/construction_uom.py
  22. 二進制
      models/construction_uom.pyc
  23. 20 0
      models/construction_work.py
  24. 二進制
      models/construction_work.pyc
  25. 326 0
      models/data_construction_task.py
  26. 二進制
      models/data_construction_task.pyc
  27. 300 0
      static/src/css/style.css
  28. 442 0
      static/src/js/eiru_civil_engineering.js
  29. 569 0
      static/src/js/eiru_civil_engineering_contractor.js
  30. 220 0
      static/src/js/eiru_civil_invoice_task_expenses.js
  31. 9 0
      static/src/xml/add_task.xml
  32. 9 0
      static/src/xml/add_task_contractor.xml
  33. 9 0
      static/src/xml/add_task_invoice_expenses.xml
  34. 110 0
      static/src/xml/modal/modal_task.xml
  35. 120 0
      static/src/xml/modal/modal_task_contractor.xml
  36. 77 0
      static/src/xml/modal/modal_task_invoice_expenses.xml
  37. 11 0
      views/data.xml
  38. 54 0
      views/eiru_construction_account_invoice.xml
  39. 97 0
      views/eiru_construction_config.xml
  40. 36 0
      views/eiru_construction_expenses_move_line.xml
  41. 10 0
      views/eiru_construction_menu.xml
  42. 163 0
      views/eiru_construction_move.xml
  43. 121 0
      views/eiru_construction_order.xml
  44. 83 0
      views/eiru_construction_order_contractor.xml
  45. 34 0
      views/eiru_construction_order_sequence.xml
  46. 58 0
      views/eiru_construction_oum.xml
  47. 72 0
      views/eiru_construction_task.xml
  48. 65 0
      views/eiru_construction_task_line.xml
  49. 62 0
      views/eiru_construction_work.xml
  50. 81 0
      views/eiru_res_partner_contractor.xml
  51. 12 0
      views/templates.xml

+ 5 - 0
README.md

@@ -0,0 +1,5 @@
+# Eiru Civil Engineering
+Modulo para facilitar la creación de los proyecto en la área de  ingeniera  civil.
+
+# construction task
+# construction task line 

+ 2 - 0
__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import models

二進制
__init__.pyc


+ 36 - 0
__openerp__.py

@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+{
+    'name': "Eiru Civil Engineering",
+    'author': "Adrielso Kunert",
+    'category': 'Account, sale',
+    'version': '0.0.1',
+    'description': "Modulo para Ingeniera civil",
+    'depends': [
+        'base',
+        'account',
+        'eiru_assets',
+        'project',
+        'eiru_payments_invoices'
+    ],
+    'data': [
+        'views/templates.xml',
+        'views/eiru_construction_menu.xml',
+        'views/eiru_construction_config.xml',
+        'views/eiru_construction_oum.xml',
+        'views/eiru_construction_task.xml',
+        'views/eiru_construction_task_line.xml',
+        'views/eiru_construction_work.xml',
+        'views/eiru_construction_order.xml',
+        'views/eiru_construction_order_contractor.xml',
+        'views/eiru_res_partner_contractor.xml',
+        'views/eiru_construction_account_invoice.xml',
+        'views/eiru_construction_move.xml',
+        'views/data.xml',
+        'views/eiru_construction_order_sequence.xml',
+        'views/eiru_construction_expenses_move_line.xml',
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+        'static/src/xml/modal/*.xml',
+    ]
+}

+ 11 - 0
models/__init__.py

@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+import construction_uom
+import construction_task
+import data_construction_task
+import construction_work
+import construction_order
+import construction_account_invoice
+import construction_order_contractor
+import construction_move
+import construction_expenses_move_line
+import construction_config

二進制
models/__init__.pyc


+ 159 - 0
models/construction_account_invoice.py

@@ -0,0 +1,159 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+
+''' Account Invoice'''
+class AccountInvoiceConstruction(models.Model):
+    _inherit = 'account.invoice'
+
+    construction_order_id = fields.Many2one('construction.order', string='Orden', ondelete='cascade', index=True, domain="[('type','=','order')]")
+
+    # @api.model
+    # def save_payments_invoice(self, values):
+    #     paymentsInvoice = super(AccountInvoiceConstruction, self).save_payments_invoice(values)
+    #     invoice = self.env['account.invoice'].browse(values['invoiceId'])
+    #     if (not invoice):
+    #         return {
+    #             'process': False,
+    #             'removeModal': True,
+    #             'message': 'No fue posible localizar la factura.'
+    #         }
+    #
+    #     if ((paymentsInvoice['process']) and (invoice.construction_move_id)):
+    #         move = self.env['construction.move'].browse(invoice.construction_move_id.id)
+    #         if (not move):
+    #             return paymentsInvoice
+    #
+    #         move.recalculate_paid_invoice(values['amountPayments'])
+    #
+    #     return paymentsInvoice
+
+    @api.model
+    def _compute_residual(self):
+
+        if ((self.construction_move_id) and (self.type =='out_invoice')):
+            super(AccountInvoiceConstruction, self)._compute_residual()
+
+            move = self.env['construction.move'].browse(self.construction_move_id.id)
+            if (move):
+                amountTotal = self.amount_total or 0.0
+                residual = self.residual or 0.0
+                amountPaidTotal = (self.amount_total - self.residual) or 0.0
+
+                move.recalculate_paid_invoice(amountTotal, amountPaidTotal,residual)
+
+        super(AccountInvoiceConstruction, self)._compute_residual()
+
+    ''' Get Task invoices Expenses '''
+    @api.model
+    def getAccountInvoiceOrder(self, id):
+        invoice = self.env['account.invoice'].browse(id)
+        taskOrdeLine = []
+        if (not invoice):
+            return False
+
+        accountOrden = self.env['construction.move'].search([('order_id.id', '=', invoice.construction_order_id.id)])
+        if (not accountOrden):
+            return False
+
+        for line in accountOrden.move_lines_ids:
+
+            expense = self.env['construction.expenses.move.line'].search([('invoice_id.id','=',invoice.id),('move_line_id.id','=',line.id)])
+
+            if ((expense) or (line.type == 'task')):
+                continue
+
+            taskOrdeLine.append({
+                # 'selected': False,
+                # 'code': line.code,
+                # 'taskName': line.task_name,
+                # 'quantity': expense.quantity  if (expense) else 0,
+                # 'priceUnit': expense.price_unit if (expense) else 0,
+                # 'amountTotal': expense.amount_total if (expense) else 0,
+
+                'code': line.code,
+                'taskName': line.task_name,
+                'amountTotal': line.amount_total,
+                'amountExpenses': line.amount_expenses,
+                'residual': line.residual,
+                'moveLineId': line.id
+            })
+            '''
+                move_id = fields.Many2one('construction.move', string='move', ondelete='cascade', index=True)
+                uom_id = fields.Many2one('construction.uom', string='Unidad de medida')
+                task_id = fields.Many2one('construction.task', string='Tarea')
+                task_line_id = fields.Many2one('construction.task.line', string='Actividad')
+                type = fields.Selection([('task', 'Tarea'),('activity', 'Actividad')])
+                # Importe Pagado, Total , Residual
+                expenses_ids = fields.One2many('construction.expenses.move.line', 'move_line_id', string='Expenses')
+            '''
+        return taskOrdeLine
+
+        '''
+            construction.expenses.move.line
+            'name':
+            'code':
+            'move_line_id' :
+            'invoice_line_id' :
+            'quantity' :
+            'price_unit' :
+            'amount_total' :
+            'invoice_id' :
+
+        construction.move.line
+            move_id = fields.Many2one('construction.move', string='move', ondelete='cascade', index=True)
+            code = fields.Char('Code', size=32)
+            task_name = fields.Char('name')
+            uom_id = fields.Many2one('construction.uom', string='Unidad de medida')
+            task_id = fields.Many2one('construction.task', string='Tarea')
+            task_line_id = fields.Many2one('construction.task.line', string='Actividad')
+            type = fields.Selection([('task', 'Tarea'),('activity', 'Actividad')])
+            # Importe Pagado, Total , Residual
+            amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+            amount_expenses = fields.Float('Amount Expenses', digits_compute=dp.get_precision('Account'), default=0.0)
+            residual = fields.Float('Amount Residual', digits_compute=dp.get_precision('Account'), default=0.0)
+            expenses_ids = fields.One2many('construction.expenses.move.line', 'move_line_id', string='Expenses')
+        '''
+
+    ''' GET currency Invoice'''
+    @api.model
+    def getCurrencyInvoceExpenses(self, idInvoice):
+        invoice = self.env['account.invoice'].browse(idInvoice)
+        company = self.env.user.company_id
+
+        currencyID = invoice.currency_id.id or company.currency_id.id
+        currency = self.env['res.currency'].search([('id', '=', currencyID)])
+        if (not currency):
+            return False
+
+        return {
+            'thousandsSeparator': currency.thousands_separator,
+            'decimalPlaces': currency.decimal_places,
+            'decimalSeparator': currency.decimal_separator,
+            'name': currency.local_name,
+            'symbol ':currency.symbol,
+        }
+
+    ''' ADD Task exepnse Move '''
+    @api.model
+    def addTaskExpensesMove(self, invoiceId, tasks):
+        invoice = self.env['account.invoice'].browse(invoiceId)
+        if (not invoice):
+            return {
+                'state': False,
+                'message': 'No Fue posible localizar la factura'
+            }
+
+        for task in tasks:
+            moveline = self.env['construction.move.line'].browse(task['moveLineId'])
+
+            exepnseMove = {
+                'invoice_id': invoice.id,
+                'code': task['code'],
+                'move_line_id': task['moveLineId'],
+                'name': moveline.task_name if (moveline) else ''
+            }
+
+            moveExpense = self.env['construction.expenses.move.line'].create(exepnseMove)
+
+        return {'state': True}

二進制
models/construction_account_invoice.pyc


+ 52 - 0
models/construction_config.py

@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+
+class ConstructionConfig(models.Model):
+    _name = 'construction.config'
+
+    name = fields.Char('Name', required=True, readonly=True)
+    active =  fields.Boolean('active',default=True)
+    comment = fields.Text('Comment', help="Información adicional")
+    ''' Invoice '''
+    invoice_journal_id = fields.Many2one('account.journal', string='Journal', required=True, domain="[('type','=','sale')]", help="Diario que utilizara para la facturación")
+    invoice_account_id = fields.Many2one('account.account', string='Account', required=True, domain="[('type','=','receivable')]")
+    ''' Line '''
+    line_account_id = fields.Many2one('account.account', string='Account', required=True, domain=[('type','=','other')])
+    line_tax_id = fields.Many2one('account.tax', string='Tax', domain=[('type_tax_use','=','sale')])
+
+    @api.model
+    def create_default_construction_config(self):
+        config = {
+            'name': 'Facturación de cliente',
+            'invoice_journal_id': self.get_account_journal_construction({'code':'VENTA', 'type': 'sale'}),
+            'invoice_account_id': self.get_account_account_construction({'code':'121000', 'type':'receivable'}),
+            'line_account_id': self.get_account_account_construction({'code':'411.01', 'type':'other'}),
+            'comment': 'Creación de factura de cliente desde la orden de servicio',
+        }
+
+        constructionConfig = self.env['construction.config'].search([('name', '=', config['name'])])
+
+        if (not constructionConfig):
+            constructionConfig.create(config)
+
+
+    def get_account_account_construction(self, vals):
+        account = self.env['account.account'].search([('code','=', vals['code']),('type','=',vals['type'])])
+        if (not account):
+            return ''
+
+        if (len(account) > 1):
+            account = account[len(account) -1]
+
+        return account.id or ''
+
+    def get_account_journal_construction(self, vals):
+        journal = self.env['account.journal'].search([('code','=',vals['code']),('type','=',vals['type'])])
+        if (not journal):
+            return ''
+
+        if (len(journal) > 1):
+            journal = journal[len(journal)-1]
+
+        return journal.id or ''

二進制
models/construction_config.pyc


+ 69 - 0
models/construction_expenses_move_line.py

@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api, _
+import openerp.addons.decimal_precision as dp
+from  openerp.exceptions import Warning, except_orm, AccessError
+
+
+class ConstructionExpensesMoveLine(models.Model):
+    _name = 'construction.expenses.move.line'
+
+    name = fields.Char('name')
+    ''' Move Line '''
+    code = fields.Char('Code', size=32)
+    move_line_id = fields.Many2one('construction.move.line', string='Move Line', ondelete='restrict', index=True)
+    invoice_id = fields.Many2one('account.invoice', string='Invoice', ondelete='restrict', index=True)
+    quantity = fields.Float('Price Unit', default=0.0)
+    price_unit = fields.Float('Price Unit', digits_compute=dp.get_precision('Account'), default=0.0)
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+    comment = fields.Text('Comment', help='information')
+
+    invoice_line_id = fields.Many2one('account.invoice.line', string='Invoice Line', ondelete='restrict', index=True)
+    ''' Invoice Line '''
+
+    ''' onchange select invoice line '''
+    @api.onchange('invoice_line_id')
+    def cheak_line_invoice(self):
+        line = self.invoice_line_id
+
+        self.quantity = line.quantity
+        self.price_unit = line.price_unit
+        self.amount_total = self.quantity * self.price_unit
+
+    ''' onchange Amount and quantity '''
+    @api.onchange('quantity', 'price_unit')
+    def onchange_amount_expenses(self):
+        self.amount_total = self.quantity * self.price_unit
+
+
+    @api.multi
+    def write(self, vals):
+        newVals = sorted(vals)
+
+        qty = vals['quantity'] if('quantity' in newVals) else self.quantity
+        priceUnit = vals['price_unit'] if('price_unit' in newVals) else self.price_unit
+
+        vals['amount_total'] = qty * priceUnit
+        expensesMove = super(ConstructionExpensesMoveLine, self).write(vals)
+
+        moveLine = self.env['construction.move.line'].browse(self.move_line_id.id)
+        if (moveLine):
+            amount = 0
+            for expense in moveLine.expenses_ids:
+                amount += expense.amount_total
+
+            moveLine.amount_expenses = amount
+            moveLine.residual = moveLine.amount_total - amount
+            # import web_pdb; web_pdb.set_trace()
+            moveLine.recalculate_paid_expense()
+
+
+
+class ConstructionMoveLineExpenses(models.Model):
+    _inherit = 'construction.move.line'
+
+    expenses_ids = fields.One2many('construction.expenses.move.line', 'move_line_id', string='Expenses')
+
+class AccountInvoiceMoveLineExpenses(models.Model):
+    _inherit = 'account.invoice'
+
+    expenses_ids = fields.One2many('construction.expenses.move.line', 'invoice_id', string='Expenses')

二進制
models/construction_expenses_move_line.pyc


+ 181 - 0
models/construction_move.py

@@ -0,0 +1,181 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api, _
+import openerp.addons.decimal_precision as dp
+from  openerp.exceptions import Warning, except_orm, AccessError
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from pytz import timezone
+from datetime import datetime,timedelta
+import logging
+_logger = logging.getLogger(__name__)
+
+class ConstructionMove(models.Model):
+    _name = 'construction.move'
+
+    name = fields.Char('name')
+    date = fields.Date()
+    state = fields.Selection([('draft','Borrador'),('posted', 'Fijado')], default='draft')
+    ref = fields.Char('Ref')
+    comment = fields.Text('Comment', help='information')
+    partner_id = fields.Many2one('res.partner', string='partner')
+    order_id = fields.Many2one('construction.order', string='order')
+    work_id = fields.Many2one('construction.work', string='obra')
+    type = fields.Selection([('order', 'Orden'),('contractor', 'Contratista')])
+    currency_id = fields.Many2one('res.currency', string="Currency", help="Moneda de la operación", required=True)
+
+    ''' Line '''
+    move_lines_ids = fields.One2many('construction.move.line', 'move_id', string='lines')
+    '''Valor total de la Orden.'''
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+    '''valor total pagado.'''
+    amount_paid = fields.Float('Amount paid', digits_compute=dp.get_precision('Account'), default=0.0)
+    '''  Saldo de la orden.'''
+    residual = fields.Float('Amount Residual', digits_compute=dp.get_precision('Account'), default=0.0)
+    '''Valor total de los gasto  registrado de la orden.'''
+    amount_expenses = fields.Float('Amount Expenses', digits_compute=dp.get_precision('Account'), default=0.0)
+    '''Valor disponible para generar gastos  de la orden.'''
+    available_expenses = fields.Float('Available Expenses', digits_compute=dp.get_precision('Account'), default=0.0)
+    ''' invoice '''
+    invoice_id = fields.Many2one('account.invoice', string='Invoice Reference', ondelete='restrict', index=True)
+
+    ''' timezone '''
+    def get_timezone(self):
+        return timezone(self._context.get('tz') or self.env.user.tz)
+
+    ''' Datetime '''
+    def get_datetime(self):
+        return datetime.now(self.get_timezone()).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+    ''' Date '''
+    def get_date(self):
+        return datetime.now(self.get_timezone()).strftime(DEFAULT_SERVER_DATE_FORMAT)
+
+    ''' CREATE INVOICE '''
+    def createInvoiceMove(self):
+        _logger.info('Create invoice')
+        decimal_precision = self.env['decimal.precision'].precision_get('Account')
+        dateServer = self.get_date()
+
+        constructionConfig = self.env['construction.config'].search([('active', '=', True)])
+        if (not constructionConfig):
+            raise except_orm(_('Warning'),_('No fue posible localizar la configuración de factura de orden de servicios'))
+
+        invoice_line = []
+        invoice = []
+        invoice_line.append([0,False, {
+            'name': 'Servicios',
+            'account_id': constructionConfig.line_account_id.id,
+            'quantity': 1,
+            'price_unit': round((self.amount_total),decimal_precision),
+            'price_subtotal': round((self.amount_total),decimal_precision),
+            'partner_id': self.partner_id.id,
+            'invoice_line_tax_id': [(6, 0,[x.id for x in constructionConfig.line_tax_id])],
+        }])
+
+        invoice = {
+            'partner_id': self.partner_id.id,
+            'currency_id': self.currency_id.id,
+            'date_invoice': dateServer,
+            'journal_id': constructionConfig.invoice_journal_id.id,
+            'account_id': constructionConfig.invoice_account_id.id,
+            'invoice_line': invoice_line,
+            'origin': '%s' % (self.order_id.name),
+            'type': 'out_invoice',
+            'construction_order_id': self.order_id.id,
+        }
+
+        # #  Create / open /invoice
+        accountInvoice = self.env['account.invoice'].create(invoice)
+        accountInvoice.signal_workflow('invoice_open')
+
+        self.write({'invoice_id': accountInvoice.id})
+
+        return True
+        # import web_pdb; web_pdb.set_trace()
+
+    ''' recalculate_paid_invoice'''
+    def recalculate_paid_invoice(self, amountTotal, amountPaidTotal, residual):
+        # Paid
+        # amountPaid = self.amount_paid or 0
+        amountPaid = amountPaidTotal
+        # Residual
+        residual = residual
+        # Available expenses
+        available = amountPaid - self.amount_expenses
+
+        self.write({
+            'amount_paid': amountPaid,
+            'residual': residual,
+            'available_expenses': available,
+        })
+
+        return True
+
+
+''' RES PARTNER '''
+class ConstructionOrderMove(models.Model):
+    _inherit =  'construction.order'
+
+    construction_move_id = fields.One2many('construction.move', 'order_id', string='Move')
+
+''' RES PARTNER '''
+class ResPartnerMove(models.Model):
+    _inherit =  'res.partner'
+
+    construction_move_id = fields.One2many('construction.move', 'partner_id', string='Move')
+
+''' Account Invoice '''
+class AccountInvoiceMove(models.Model):
+    _inherit =  'account.invoice'
+
+    construction_move_id = fields.One2many('construction.move', 'invoice_id', string='Invoice')
+
+''' Line '''
+class ConstructionMoveLine(models.Model):
+    _name = 'construction.move.line'
+
+    move_id = fields.Many2one('construction.move', string='move', ondelete='cascade', index=True)
+
+    code = fields.Char('Code', size=32)
+    task_name = fields.Char('name')
+    uom_id = fields.Many2one('construction.uom', string='Unidad de medida')
+    task_id = fields.Many2one('construction.task', string='Tarea')
+    task_line_id = fields.Many2one('construction.task.line', string='Actividad')
+    type = fields.Selection([('task', 'Tarea'),('activity', 'Actividad')])
+
+    ''' Importe Pagado, Total , Residual '''
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+    amount_expenses = fields.Float('Amount Expenses', digits_compute=dp.get_precision('Account'), default=0.0)
+    residual = fields.Float('Amount Residual', digits_compute=dp.get_precision('Account'), default=0.0)
+
+    expenses_ids = fields.One2many('construction.expenses.move.line', 'move_line_id', string='Expenses')
+
+    def recalculate_paid_expense(self):
+        move = self.env['construction.move'].browse(self.move_id.id)
+        if (not move):
+            return False
+
+        for line in move.move_lines_ids:
+            if (line.type == 'task'):
+                task = line.task_id.id
+                # amountTotal = line.amount_total
+                amountExpense = 0
+            for lineActivity in move.move_lines_ids:
+                if (lineActivity.type == 'activity'):
+                    amountExpense +=  lineActivity.amount_expenses
+
+            if (line.type == 'task'):
+                line.write({
+                    'amount_expenses' : amountExpense,
+                    'residual' : line.amount_total - amountExpense
+                })
+
+            # import web_pdb; web_pdb.set_trace()
+
+
+        # task_id
+        # task_line_id
+            # if (line.type =='activity'):
+                # ammount +=line.amount_total
+
+            # amount_total
+            # amount_expenses
+            # residual

二進制
models/construction_move.pyc


+ 226 - 0
models/construction_order.py

@@ -0,0 +1,226 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+
+class constructionOrder(models.Model):
+    _name = 'construction.order'
+
+    name = fields.Char('name')
+    date = fields.Date()
+    active = fields.Boolean('Active', default=True)
+    work_id = fields.Many2one('construction.work', string='obra', required=True)
+    partner_id = fields.Many2one('res.partner', string='owner', help='owner of the work', required=True)
+    order_street = fields.Char('street')
+    order_city = fields.Char('city')
+    total_area = fields.Float('Superficie', required=True)
+    ref = fields.Char('Ref')
+    comment = fields.Text('Comment', help='information')
+    type = fields.Selection([('budget', 'Presupuesto'),('order', 'orden')])
+    line_ids = fields.One2many('construction.order.line', 'order_ids', string='lines')
+    state = fields.Selection([('draft', 'Borrador'),('done', 'Hecho')], default='draft')
+    currency_id = fields.Many2one('res.currency', string="Currency", help="Moneda de la operación", required=True)
+    ''' order & budget'''
+    budget_id = fields.Many2one('construction.order', string='Budget', ondelete='restrict', index=True)
+    order_id = fields.Many2one('construction.order', string='Orden', ondelete='restrict', index=True)
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+
+
+    @api.model
+    def create(self, vals):
+        vals['type'] = self._context.get('type')
+        if (self._context.get('type') == 'budget'):
+            vals['name'] = self.env['ir.sequence'].get('construction.order.budget') or '/'
+        else:
+            vals['name'] = self.env['ir.sequence'].get('construction.order.order') or '/'
+        return super(constructionOrder, self).create(vals)
+
+    @api.model
+    def get_currency_order(self, id):
+        order = self.env['construction.order'].browse(id)
+        company = self.env.user.company_id
+        currencyID = order.currency_id.id or company.currency_id.id
+        currency = self.env['res.currency'].search([('id', '=', currencyID)])
+        if (not currency):
+            return False
+
+        return {
+            'thousandsSeparator': currency.thousands_separator,
+            'decimalPlaces': currency.decimal_places,
+            'decimalSeparator': currency.decimal_separator,
+            'name': currency.local_name,
+            'symbol ':currency.symbol,
+        }
+
+    @api.model
+    def eiru_add_task(self, id,tasks):
+        line = self.env['construction.order.line'].search([('order_ids', '=', id )])
+        lineTask = []
+        if ( line ):
+            for i in line:
+                i.unlink()
+
+        for task in tasks:
+            lineTask= {
+                'code':task['code'],
+                'task_name': task['taskName'],
+                'uom_id': task['uomId'],
+                'task_id': task['taskId'],
+                'task_line_id': task['taskLineId'],
+                'qty': task['qty'],
+                'amount': task['amount'],
+                'amount_total': task['amountTotal'],
+                'type': task['type'],
+                'order_ids': id
+            }
+            line.create(lineTask)
+
+        order = self.env['construction.order'].browse(id)
+        if (not order):
+            return {'state': False }
+        ammount = 0
+        for line in order.line_ids:
+            if (line.type =='activity'):
+                ammount +=line.amount_total
+
+        order.write({'amount_total': ammount})
+        return {'state': True }
+
+    @api.model
+    def action_confirm_budget(self, idBudget):
+        orderBudget = self.env['construction.order'].browse(idBudget)
+        if (not orderBudget):
+            return
+
+        order = orderBudget.copy()
+        if (not order):
+            return
+
+        order.write({
+            'name': self.env['ir.sequence'].get('construction.order.order') or '/',
+            'type': 'order',
+            'budget_id': orderBudget.id
+        })
+        lines = orderBudget.line_ids.copy()
+        for line in lines:
+            line.write({'order_ids': order.id})
+
+        ''' Actualizar el numero de orden en elregistro de Subcontratista'''
+        for contractor in orderBudget.contractor_budget_ids:
+            contractor.write({'order_id': order.id})
+        ''' Actualizar en numero de orden en el presupuesto '''
+        orderBudget.write({'state': 'done', 'order_id': order.id})
+        return True
+
+    @api.model
+    def action_confirm_order(self, idOrder):
+        move = []
+        moveLines = []
+        order = self.env['construction.order'].browse(idOrder)
+        if (not order):
+            return False
+
+        for line in order.line_ids:
+            moveLines.append([0, False,{
+                'code': line.code,
+                'task_name': line.task_name,
+                'uom_id': line.uom_id.id,
+                'task_id': line.task_id.id,
+                'task_line_id': line.task_line_id.id,
+                'type': line.type,
+                'amount_total': line.amount_total,
+                'amount_paid': 0,
+                'residual': line.amount_total,
+            }])
+
+        move = {
+            'partner_id': order.partner_id.id,
+            'order_id': order.id,
+            'work_id': order.work_id.id,
+            'amount_total': order.amount_total,
+            'amount_paid': 0,
+            'residual': order.amount_total,
+            'type': 'order',
+            'move_lines_ids': moveLines,
+            'currency_id': order.currency_id.id
+        }
+        # create
+        moveOrder = self.env['construction.move'].create(move)
+        if (not moveOrder):
+            return False
+
+        moveOrder.createInvoiceMove()
+
+        ''' Contratista '''
+        move = []
+
+        for contractor in order.contractor_order_ids:
+            moveLines = []
+            for line in contractor.line_ids:
+                moveLines.append([0, False,{
+                    'code': line.code,
+                    'task_name': line.task_name,
+                    'uom_id': line.uom_id.id,
+                    'task_id': line.task_id.id,
+                    'task_line_id': line.task_line_id.id,
+                    'type': line.type,
+                    'amount_total': line.amount_total,
+                    'amount_paid': 0,
+                    'residual': line.amount_total,
+                }])
+
+            move = {
+                'partner_id': contractor.partner_id.id,
+                'order_id': order.id,
+                'work_id': order.work_id.id,
+                'amount_total': contractor.amount_total,
+                'amount_paid': 0,
+                'residual': contractor.amount_total,
+                'type': 'contractor',
+                'move_lines_ids': moveLines,
+                'currency_id': order.currency_id.id
+            }
+            moveOrder = self.env['construction.move'].create(move)
+            if (not moveOrder):
+                return False
+
+        order.write({'state': 'done'})
+
+
+''' RES PARTNER '''
+class ResPartnerOrder(models.Model):
+    _inherit =  'res.partner'
+
+    construction_budget = fields.One2many('construction.order', 'partner_id', string='Budget', domain=[('type', '=', 'budget')])
+    construction_order = fields.One2many('construction.order', 'partner_id', string='Order', domain=[('type', '=', 'order')])
+
+
+
+class constructionOrderLine(models.Model):
+    _name = 'construction.order.line'
+
+    code = fields.Char('Code', size=32, required=True, select=True)
+    task_name = fields.Char('name')
+    uom_id = fields.Many2one('construction.uom', string='Unidad de medida')
+    task_id = fields.Many2one('construction.task', string='Tarea')
+    task_line_id = fields.Many2one('construction.task.line', string='Actividad')
+    qty = fields.Float('Cantidad', default=0)
+    amount = fields.Float('Amount Unit', digits_compute=dp.get_precision('Account'), default=0.0)
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+    type = fields.Selection([('task', 'Tarea'),('activity', 'Actividad')])
+    order_ids = fields.Many2one('construction.order', string='Orden', ondelete='cascade', index=True, required=True)
+
+    ''' Get Line in order '''
+    def get_construction_order_line(self, orderID):
+        return [{
+            'id': line.id,
+            'code': line.code,
+            'taskName': line.task_name,
+            'uomId': line.uom_id.id  if(line.uom_id) else "",
+            'uomName': line.uom_id.name  if(line.uom_id) else "" ,
+            'taskId': line.task_id.id,
+            'taskLineId': line.task_line_id.id if(line.task_line_id) else "",
+            'qty': line.qty,
+            'amount': line.amount,
+            'amountTotal': line.amount_total,
+            'type': line.type,
+        } for line in self.env['construction.order.line'].search([('order_ids', '=', orderID)])]

二進制
models/construction_order.pyc


+ 99 - 0
models/construction_order_contractor.py

@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api, _
+import openerp.addons.decimal_precision as dp
+from  openerp.exceptions import Warning, except_orm, AccessError
+
+class constructionOrderContractor(models.Model):
+    _name = 'construction.order.contractor'
+
+    name = fields.Char('name')
+    date = fields.Date()
+    active = fields.Boolean('Active', default=True)
+    ref = fields.Char('Ref')
+    comment = fields.Text('Comment', help='information')
+    state = fields.Selection([('draft', 'Borrador'),('done', 'Hecho')], default='draft')
+    ''' Contratista && subcontratista '''
+    partner_id = fields.Many2one('res.partner', string='contractor', required=True)
+    ''' ORDER && PRESUPUSETO '''
+    budget_id = fields.Many2one('construction.order', string='budget', required=True)
+    order_id = fields.Many2one('construction.order', string='order')
+    line_ids = fields.One2many('construction.order.contractor.line', 'order_contractor_ids', string='lines')
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+
+    ''' CREATE '''
+    @api.model
+    def create(self, vals):
+        partner = self.env['res.partner'].browse(vals['partner_id'])
+        budget = self.env['construction.order'].browse(vals['budget_id'])
+        name ="Subcontratista/%s/%s" % (partner.name, budget.name)
+        vals['name'] = name.upper()
+        return super(constructionOrderContractor, self).create(vals)
+
+    ''' Currency '''
+    @api.model
+    def get_currency_budget(self, id):
+        contractor = self.env['construction.order.contractor'].browse(id)
+        budget = contractor.budget_id
+        return budget.get_currency_order(budget.id)
+
+    @api.model
+    def add_task_contractor(self, id,tasks):
+        line = self.env['construction.order.contractor.line'].search([('order_contractor_ids', '=', id )])
+        lineTask = []
+        if ( line ):
+            for i in line:
+                i.unlink()
+
+        for task in tasks:
+            lineTask= {
+                'code':task['code'],
+                'task_name': task['taskName'],
+                'uom_id': task['uomId'],
+                'task_id': task['taskId'],
+                'task_line_id': task['taskLineId'],
+                'qty': task['qty'],
+                'amount': task['amount'],
+                'amount_total': task['amountTotal'],
+                'type': task['type'],
+                'order_contractor_ids': id,
+            }
+            line.create(lineTask)
+
+            contractor = self.env['construction.order.contractor'].browse(id)
+            if (not contractor):
+                return {'state': False }
+
+            ammount = 0
+            for line in contractor.line_ids:
+                if (line.type =='activity'):
+                    ammount += line.amount_total
+
+            contractor.write({'amount_total': ammount})
+
+        return {'state': True }
+
+class ConstructionOrder(models.Model):
+    _inherit = 'construction.order'
+
+    contractor_budget_ids = fields.One2many('construction.order.contractor', 'budget_id', string='contractor')
+    contractor_order_ids = fields.One2many('construction.order.contractor', 'order_id', string='contractor')
+
+''' RES PARTNER '''
+class ResPartnerContractor(models.Model):
+    _inherit =  'res.partner'
+
+    contractor = fields.Boolean('contractor', default=False, help='Define si es un contratista o un subcontratista')
+
+class constructionOrderContractorLine(models.Model):
+    _name = 'construction.order.contractor.line'
+
+    code = fields.Char('Code', size=32, required=True, select=True)
+    task_name = fields.Char('name')
+    uom_id = fields.Many2one('construction.uom', string='Unidad de medida')
+    task_id = fields.Many2one('construction.task', string='Tarea')
+    task_line_id = fields.Many2one('construction.task.line', string='Actividad')
+    qty = fields.Float('Cantidad', default=0)
+    amount = fields.Float('Amount Unit', digits_compute=dp.get_precision('Account'), default=0.0)
+    amount_total = fields.Float('Amount Total', digits_compute=dp.get_precision('Account'), default=0.0)
+    type = fields.Selection([('task', 'Tarea'),('activity', 'Actividad')])
+    order_contractor_ids = fields.Many2one('construction.order.contractor', string='Orden Contratista', ondelete='cascade', index=True, required=True)

二進制
models/construction_order_contractor.pyc


+ 140 - 0
models/construction_task.py

@@ -0,0 +1,140 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+
+class constructionTask(models.Model):
+    _name = 'construction.task'
+
+    name = fields.Char('name', required=True)
+    display_name = fields.Char('display_name')
+    ref = fields.Char('Ref')
+    code = fields.Char('Code', size=32, required=True, select=True)
+    active = fields.Boolean('Active', default=True)
+    comment = fields.Text('Comment', help='Información Adicional')
+    line_ids = fields.One2many('construction.task.line', 'construction_task', string='task line')
+
+    # get constructionTask
+    @api.model
+    def get_construction_task(self, orderID):
+        orderLine = self.env['construction.order.line'].get_construction_order_line(orderID)
+        ''' code, task_name, uom_id, task_id, task_line_id, qty, amount, amount_total, type, order_ids '''
+        self.env.cr.execute("SELECT id FROM construction_task ORDER BY id")
+        '''get order line '''
+
+        tasks = []
+        for task in self.env['construction.task'].browse(map(lambda x: x['id'], self.env.cr.dictfetchall())):
+            taskIn = filter(lambda x: ((x['taskId'] == task.id) and (x['type'] == 'task')), orderLine)
+
+            tasks.append({
+                'code': task.code,
+                'taskName': task.name,
+                'uomId': '',
+                'uomName': '',
+                'taskId': task.id,
+                'taskLineId': '',
+                'qty': taskIn[0]['qty'] if(len(taskIn)) else 0,
+                'amount': taskIn[0]['amount'] if(len(taskIn)) else 0,
+                'amountTotal': taskIn[0]['amountTotal'] if(len(taskIn)) else 0,
+                'type': 'task',
+                'selected': True if(len(taskIn)) else False,
+
+            })
+
+            for line  in task.line_ids:
+                taskInLine = filter(lambda x: x['taskLineId'] == line.id, orderLine)
+
+                tasks.append({
+                    'code': line.code,
+                    'taskName': line.name,
+                    'uomId': line.construction_uom.id or '',
+                    'uomName': line.construction_uom.name or  '',
+                    'taskId': task.id,
+                    'taskLineId': line.id,
+                    'qty': taskInLine[0]['qty'] if(len(taskInLine)) else 0,
+                    'amount': taskInLine[0]['amount'] if(len(taskInLine)) else 0,
+                    'amountTotal': taskInLine[0]['amountTotal'] if(len(taskInLine)) else 0,
+                    'type': 'activity',
+                    'selected': True if(len(taskInLine)) else False,
+                })
+
+        return tasks
+
+    @api.model
+    def get_task_order(self, idContractor):
+        contractor = self.env['construction.order.contractor'].browse(idContractor)
+        if (not contractor):
+            return False
+
+        tasks = []
+        lineTaskContractor = []
+
+        allContratista = self.env['construction.order.contractor'].search([('budget_id.id', '=', contractor.budget_id.id)])
+
+        for orderContractor in allContratista:
+            for line in orderContractor.line_ids:
+                lineTaskContractor.append({
+                    'qty': line.qty,
+                    'amount': line.amount,
+                    'amountTotal': line.amount_total,
+                    'orderContractorIds': orderContractor.id,
+                    'taskId': line.task_id.id,
+                    'taskLineId': line.task_line_id.id,
+                })
+        orderLine = self.env['construction.order.line'].get_construction_order_line(contractor.budget_id.id)
+        for task in self.env['construction.task'].search([('id', 'in', map(lambda x: x['taskId'], orderLine))]):
+            taskIn = filter(lambda x: ((x['taskId'] == task.id) and (x['type'] == 'task')), orderLine)
+            lineContractor = filter(lambda x: (x['taskId'] == taskIn[0]['taskId']),  lineTaskContractor)
+
+            tasks.append( {
+                'code': task.code,
+                'taskName': task.name,
+                'uomId': '',
+                'uomName': '',
+                'taskId': task.id,
+                'taskLineId': '',
+                'qty': lineContractor[0]['qty'] if(len(lineContractor)) else 0,
+                'amount': lineContractor[0]['amount'] if(len(lineContractor)) else 0,
+                'amountTotal': lineContractor[0]['amountTotal'] if(len(lineContractor)) else 0,
+                'type': 'task',
+                'selected': True if(len(lineContractor)) else False,
+                'amountBudget': taskIn[0]['amountTotal'] if(len(taskIn)) else 0,
+                'contractorId': lineContractor[0]['orderContractorIds'] if(len(lineContractor)) else '',
+            })
+
+            taskLinOrder = filter(lambda x: ((x['taskId'] == task.id) and (x['type'] == 'activity')), orderLine)
+            for line  in self.env['construction.task.line'].search([('id', 'in', map(lambda x: x['taskLineId'], taskLinOrder))]):
+                taskInLine = filter(lambda x: x['taskLineId'] == line.id, orderLine)
+                linesContractor = filter(lambda x: (x['taskLineId'] == taskInLine[0]['taskLineId']),  lineTaskContractor)
+
+
+                tasks.append({
+                    'code': line.code,
+                    'taskName': line.name,
+                    'uomId': line.construction_uom.id or '',
+                    'uomName': line.construction_uom.name or  '',
+                    'taskId': task.id,
+                    'taskLineId': line.id,
+                    'qty': taskInLine[0]['qty'],
+                    'amount': linesContractor[0]['amount'] if(len(linesContractor)) else 0,
+                    'amountTotal': linesContractor[0]['amountTotal'] if(len(linesContractor)) else 0,
+                    'type': 'activity',
+                    'amountBudget' :taskInLine[0]['amountTotal'] if(len(taskInLine)) else 0,
+                    'contractorId':linesContractor[0]['orderContractorIds'] if(len(linesContractor)) else '',
+                    'selected': True if(len(linesContractor)) else False,
+                })
+
+        return tasks
+
+class constructionTaskLine(models.Model):
+    _name = "construction.task.line"
+
+    construction_uom = fields.Many2one('construction.uom', string='Unidad de medida', ondelete='cascade', index=True, required=True)
+    construction_task = fields.Many2one('construction.task', string='construction task', ondelete='cascade', index=True, required=True)
+
+    name = fields.Char('name', required=True)
+    display_name = fields.Char('display_name')
+    ref = fields.Char('Ref')
+    code = fields.Char('Code', size=32, required=True, select=True)
+    amount = fields.Float('Amount Unit', digits_compute=dp.get_precision('Account'), required=True, default=0.0)
+    active = fields.Boolean('Active', default=True)
+    comment = fields.Text('Comment', help='Información Adicional')

二進制
models/construction_task.pyc


+ 32 - 0
models/construction_uom.py

@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+
+
+class constructionUom(models.Model):
+    _name = 'construction.uom'
+
+    name = fields.Char('name', required=True)
+    active = fields.Boolean('Active', default=True)
+    ref = fields.Char('Ref')
+    decimal_places = fields.Integer(string='Decimal Place', default=0, required=True)
+    comment = fields.Text('Comment', help='Información Adicional')
+
+    @api.model
+    def create_default_uon(self):
+
+        defaultUom = [
+            {'name':'M2','ref': 'Metros Cuadrados', 'decimal_places':2},
+            {'name':'UN', 'ref': 'Unidad', 'decimal_places':0},
+            {'name':'M3', 'ref': 'Metros  Cúbicos', 'decimal_places':3},
+            {'name':'ML', 'ref': 'Metros Lineal', 'decimal_places':2},
+            {'name':'BC', 'ref': '', 'decimal_places': 0}
+        ]
+        for uom in defaultUom:
+            oumExist = self.env['construction.uom'].search([('name', '=', uom['name'])])
+
+            if (not oumExist):
+                oumExist.create({
+                    'name': uom['name'],
+                    'ref': uom['ref'],
+                    'decimal_places': uom['decimal_places'],
+                })

二進制
models/construction_uom.pyc


+ 20 - 0
models/construction_work.py

@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+
+
+class constructionWork(models.Model):
+    _name = 'construction.work'
+
+    name = fields.Char('name', required=True)
+    active = fields.Boolean('Active', default=True)
+    ref = fields.Char('Ref')
+    partner_id = fields.Many2one('res.partner', string='owner', help='owner of the work')
+    work_street = fields.Char('street')
+    work_city = fields.Char('city')
+    comment = fields.Text('Comment', help='information')
+
+''' RES PARTNER '''
+class ResPartnerWorks(models.Model):
+    _inherit =  'res.partner'
+
+    works = fields.One2many('construction.work', 'partner_id', string='work')

二進制
models/construction_work.pyc


+ 326 - 0
models/data_construction_task.py

@@ -0,0 +1,326 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+
+class dataConstructionUom(models.Model):
+    _inherit = 'construction.uom'
+
+    @api.model
+    def create_default_uon(self):
+
+        defaultUom = [
+            {'name':'M2','ref': 'Metros Cuadrados', 'decimal_places':2},
+            {'name':'UN', 'ref': 'Unidad', 'decimal_places':0},
+            {'name':'M3', 'ref': 'Metros  Cúbicos', 'decimal_places':3},
+            {'name':'ML', 'ref': 'Metros Lineal', 'decimal_places':2},
+            {'name':'BC', 'ref': '', 'decimal_places': 0}
+        ]
+        for uom in defaultUom:
+            oumExist = self.env['construction.uom'].search([('name', '=', uom['name'])])
+
+            if (not oumExist):
+                oumExist.create({
+                    'name': uom['name'],
+                    'ref': uom['ref'],
+                    'decimal_places': uom['decimal_places'],
+                })
+
+    def get_oum_name(self, name):
+        return self.env['construction.uom'].search([('name', '=', name)]).id or None
+
+class dataConstructionTask(models.Model):
+    _inherit = 'construction.task'
+
+    @api.model
+    def create_default_task(self):
+        oumTask = self.env['construction.uom']
+        tasks = [
+            {
+                'code': '1',
+                'name': 'PROYECTOS (APAR-LEY 1012)',
+                'line_ids': [
+                    {'code': '1.1', 'name': 'Estudios preliminares y programación', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.2', 'name': 'Anteproyecto',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.3', 'name': 'Diseño arquitectonico detallado', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.4', 'name': 'Diseño estructural y especificaciones', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.5', 'name': 'Memoria general y especificaciones', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.6', 'name': 'Direccion  de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.7', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '1.8', 'name': 'Serviocio de mano de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '2',
+                'name': 'TRABAJOS PRELIMINARES',
+                'line_ids': [
+                    {'code': '2.1', 'name': 'Obrajero',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.2', 'name': 'Galpon de obra',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.3', 'name': 'Conexión de energia electrica (ANDE)',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.4', 'name': 'Conexión de agua corriente',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.5', 'name': 'Conexión a red cloacal y sanitaria',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.6', 'name': 'Replanteo de obra',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.7', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '2.8', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '3',
+                'name': 'MOVIMIENTO DE SUELO',
+                'line_ids':[
+                    {'code': '3.1', 'name': ' Terraplenado', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.2', 'name': 'Excabaciones a maquinas', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.3', 'name': 'Desmonte manual', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.4', 'name': 'Rellenos', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.5', 'name': 'Limpieza y destronco de arboles',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.6', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '3.7', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+
+                'code': '4',
+                'name': 'FUNDACION',
+                'line_ids': [
+                    {'code': '4.1', 'name': 'Excabacion para zapatas',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.2', 'name': 'Zapata',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.3', 'name': 'Colmmunas o pilares',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.4', 'name': 'Bigas superior e inferior',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.5', 'name': 'Losa de hormigon armado (Hº Aº)',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.6', 'name': 'Escalera',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.7', 'name': 'Submuracion',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.8', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''},
+                    {'code': '4.9', 'name': 'Servico de mano de obra',  'construction_uom': oumTask.get_oum_name('M3'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '5',
+                'name': 'IMPERMEABILIZACON',
+                'line_ids': [
+                    {'code': '5.1', 'name': 'Aislacion horizontal 0,15m con hidrofugo y asfalto', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '5.2', 'name': 'Aislacion de losa para baño', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '5.3', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '5.4', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '','comment': ''}
+                ]
+            },
+            {
+                'code': '6',
+                'name': 'ALBAÑILERIA',
+                'line_ids': [
+                    {'code': '6.1', 'name': 'Nivelacion 0,30m',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.2', 'name': 'Mamposteria de elevacion 0,15m (ladrillo hueco)', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.3', 'name': 'Mamposteria de elevacion 0,15m (ladrillo comun)',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.4', 'name': 'Mamposteria de elevacion 0,20m (ladrillo comun)',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.5', 'name': 'Mamposteria de elevacion 0,20m (ladrillo hueco)',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.6', 'name': 'Dintel sobre abertura  / envarillado de mamposteria',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.7', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '6.8', 'name': 'Servicio de mano obra',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ],
+            },
+            {
+                'code': '7',
+                'name': 'COBERTURA  CUBIERTAS',
+                'line_ids': [
+                    {'code': '7.1', 'name': 'Estructura de madera (tirantes y vigas)',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '7.2', 'name': 'Cielo rasos (machimbre, pvc, otros)',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '7.3', 'name': 'Estructura de metal con teja',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '7.4', 'name': 'EstruC. de metal con chapa tipo teja, trapez, ondul.',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '7.5', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '7.6', 'name': 'Servcio de mano de obra',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '8',
+                'name': 'CIELORRASOS',
+                'line_ids': [
+                    {'code': '8.1', 'name': 'Yeso acartonado',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '8.2', 'name': 'Yesito placa 60x60',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '8.3', 'name': 'Yeso de pvc',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '8.4', 'name': 'Machimbre de madera',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '8.5', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '8.6', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '9',
+                'name': 'REVOQUES',
+                'line_ids': [
+                    {'code': '9.1', 'name': 'Revoque una capa sin hidrofugo en interiores',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '9.2', 'name': 'Revoque una capa con hidrofugo en exteriores',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '9.3', 'name': 'Azotada impermeable 0,5m',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '9.4', 'name': 'Revoque de cielo raso a una capa',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '9.5', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '9.6', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '10',
+                'name': 'CONTRAPISO Y CARPETA ALISADA',
+                'line_ids':[
+                    {'code': '10.1', 'name': 'Contrapiso de 7cm',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '10.2', 'name': 'Contrapiso de hormigon de cascotes',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '10.3', 'name': 'Contrapiso en losa sanitaria 20cm',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '10.4', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '10.5', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                ]
+            },
+            {
+                'code': '11',
+                'name': 'REVESTIMIENTO',
+                'line_ids': [
+                    {'code': '11.1', 'name': 'Azulejos', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': '* Ceramico \n* Porcelanato \n* Otros'},
+                    {'code': '11.2', 'name': 'Pisos', 'construction_uom': oumTask.get_oum_name('M2'),  'ref': '', 'comment': '* Ceramico \n* Porcelanato \n* Otros'},
+                    {'code': '11.3', 'name': 'Decorados', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': '* Pastilla de vidrio \n* Pastilla mixto \n* Otros'},
+                    {'code': '11.4', 'name': 'Granitos y marmol', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '11.5', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '11.6', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '12',
+                'name': 'ZOCALOS',
+                'line_ids':	[
+                    {'code': '12.1', 'name': 'Ceramico',  'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '12.2', 'name': 'Madera',  'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '12.3', 'name': 'PVC',  'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '12.4', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '12.5', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '13',
+                'name': 'INSTALACIONES HIDRAULICAS',
+                'line_ids': [
+                    {'code': '13.1',  'name': 'Baño social',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.2',  'name': 'Baño familiar',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.3',  'name': 'Baño suit sin bañera planta alta',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.4',  'name': 'Baño suit con bañera planta alta',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.5',  'name': 'Cocina en planta baja',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.6',  'name': 'Cocina en planta alta',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.7',  'name': 'Cocina lavadero',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.8',  'name': 'Desague pluvial',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.9',  'name': 'Desague cloacal',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.10', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '13.11', 'name': 'Servicio de mano de obra',  'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '14',
+                'name': 'INSTALCIONES ELECTRICAS',
+                'line_ids': [
+                    {'code': '14.1', 'name': 'Bocas electricas', 'construction_uom': oumTask.get_oum_name('BC'), 'ref': '', 'comment': ''},
+                    {'code': '14.2', 'name': 'Colocacion de artefactos', 'construction_uom': oumTask.get_oum_name('BC'), 'ref': '', 'comment': ''},
+                    {'code': '14.3', 'name': 'Otros',  'construction_uom': oumTask.get_oum_name('BC'), 'ref': '', 'comment': ''},
+                    {'code': '14.4', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('BC'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '15',
+                'name': "PUERTAS",
+                'line_ids': [
+                    {'code': "15.1", 'name': 'Puertas tablero (exterior)', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': "15.2", 'name': 'Puertas placas (interior)', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': "15.3", 'name': 'Puertas de aluminio (baños)', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': "15.4", 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': "15.5", 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '16',
+                'name': 'VENTANAS',
+                'line_ids': [
+                    {'code': '16.1', 'name': 'De madera', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '16.2', 'name': 'De aluminio (carpinteria)', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '16.3', 'name': 'De vidrio templado', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '16.4', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '16.5', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '17',
+                'name': 'PINTURA',
+                'line_ids': [
+                    {'code': '17.1', 'name': 'De paredes', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '17.2', 'name': 'De techo', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '17.3', 'name': 'De cielo raso', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '17.4', 'name': 'De abertura', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '17.5', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''},
+                    {'code': '17.6', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('M2'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '18',
+                'name': 'COLOCACION DE ARTEFACTOS SANITARIOS',
+                'line_ids': [
+                    {'code': '18.1', 'name': 'Lavatorio', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.2', 'name': 'Canilla', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.3', 'name': 'Bidet', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.4', 'name': 'Ducha higienica', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.5', 'name': 'Inodoro', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.6', 'name': 'Ducha electrica', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.7', 'name': 'Pileta de lavar', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.8', 'name': 'Box de baño', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.9', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '18.10', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '19',
+                'name': 'ESCALERAS - BALCONES',
+                'line_ids': [
+                    {'code': '19.1', 'name': 'Barandas de vidrios', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '19.2', 'name': 'Barandas de metal pintado', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '19.3', 'name': 'Barandas de inox', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '19.4', 'name': 'Pasa mano', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '19.5', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''},
+                    {'code': '19.6', 'name': 'Servcio de mano de obra', 'construction_uom': oumTask.get_oum_name('ML'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '20',
+                'name': 'JARDINERIA Y PAISAJISMO',
+                'line_ids': [
+                    {'code': '20.1', 'name': 'Estilo 1', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '20.2', 'name': 'Estilo 2', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '20.3', 'name': 'Estilo 3', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '20.4', 'name': 'Estilo 4', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '20.5', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '20.6', 'name': 'Servcio de mano de obra', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '21',
+                'name': 'CHURRASQUERA',
+                'line_ids': [
+                    {'code': '21.1', 'name': 'Accesorios completo (inox)', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '21.2', 'name': 'Otros accesorios', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '21.3', 'name': 'Enlozado', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '21.4', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '21.5', 'name': 'Servicio de mano de obra', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            },
+            {
+                'code': '22',
+                'name': 'PISCINAS',
+                'line_ids': [
+                    {'code': '22.1', 'name': 'Otros', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''},
+                    {'code': '22.2', 'name': 'Mano de obra', 'construction_uom': oumTask.get_oum_name('UN'), 'ref': '', 'comment': ''}
+                ]
+            }
+        ]
+
+        for task in tasks:
+            taskExist = self.env['construction.task'].search([('name', '=', task['name'])])
+
+            if (not taskExist):
+                lineids = []
+                for line in task['line_ids']:
+                    lineids.append([0, False, {
+                        'code': line['code'],
+                        'name': line['name'],
+                        'construction_uom': line['construction_uom']
+                    }])
+
+                taskExist.create({
+                    'code': task['code'],
+                    'name': task['name'],
+                    'line_ids': lineids
+                })

二進制
models/data_construction_task.pyc


+ 300 - 0
static/src/css/style.css

@@ -0,0 +1,300 @@
+.add-button-task {
+    padding: 6px !important;
+}
+
+.widget-content.widget-loading-task-select {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    color : #000;
+    display: none;
+    z-index: 1100;
+    background: #8080806b;
+    align-items: center;
+    justify-content: center;
+}
+.select-task-header {
+    font-size: 12pt;
+    padding-bottom: 10px;
+    padding-top: 10px;
+}
+.select-task-table {
+    margin-top: 0px !important;
+}
+.expired-account-modal .modal-head-wrapper-select-task {
+    width: 100%;
+}
+.expired-account-modal .modal-item-select-task {
+    width: 100%;
+    height: 400px;
+    overflow-y: auto;
+}
+.expired-account-modal .selected-task {
+     background: #d4e2f3  !important;
+}
+.expired-account-modal .disabled-task {
+     background: #d4f1ed  !important;
+}
+.select-task-item {
+    height: 20px !important;
+    margin: 0px;
+}
+.task-input {
+    text-align: right;
+    font-size: 11pt;
+    border: 1px solid #e3e3e3 !important;
+    background: #e6e4e4 !important;
+}
+.task-input-in {
+    background: white !important;
+}
+.task-header-line {
+    color: red;
+    font-weight: bold;
+}
+.task-qty {
+    width: 65px
+}
+.task-amount {
+    width: 120px
+}
+.task-amoutn-total {
+    width: 120px;
+}
+/* Table Header */
+.expired-account-modal .select-task-table table thead tr {
+    height: 40px !important;
+}
+/* SELECT */
+/* .expired-account-modal .select-task-table table thead tr th:nth-child(1){ */
+    /* width: 33px; */
+/* } */
+/* Codigo */
+.expired-account-modal .select-task-table table thead tr th:nth-child(2){
+    width: 83px;
+    text-align: right;
+    /* padding-left: 10px; */
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Descripción */
+.expired-account-modal .select-task-table table thead tr th:nth-child(3){
+    width: 368px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/*UN */
+.expired-account-modal .select-task-table table thead tr th:nth-child(4){
+    width: 35px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/*QTY */
+.expired-account-modal .select-task-table table thead tr th:nth-child(5){
+    width: 78px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Amount */
+.expired-account-modal .select-task-table table thead tr th:nth-child(6){
+    width: 140px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* TOTAL */
+.expired-account-modal .select-task-table table thead tr th:nth-child(7){
+    width: 140px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Task Id */
+.expired-account-modal .select-task-table table thead tr th:nth-child(8){
+    display: none;
+}
+/* Task Line Id */
+.expired-account-modal .select-task-table table thead tr th:nth-child(9){
+    display: none;
+}
+/* Uom Id */
+.expired-account-modal .select-task-table table thead tr th:nth-child(10){
+    display: none;
+}
+/* Type */
+.expired-account-modal .select-task-table table thead tr th:nth-child(11){
+    display: none;
+}
+/* Contractor */
+.expired-account-modal .select-task-table table thead tr th:nth-child(12){
+    display: none;
+}
+/* orderLine */
+.expired-account-modal .select-task-table table thead tr th:nth-child(13){
+    display: none;
+}
+
+/* Table Body  */
+.expired-account-modal .select-task-table table tbody tr {
+    height: 35px;
+}
+/* SELECT */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(1){
+    width: 33px;
+}
+/* CODIGO */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(2){
+    width: 50px;
+}
+/* Descripción */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(3){
+    width: 368px;
+}
+/* UN */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(4){
+    width: 35px;
+}
+/* QTY */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(5){
+    width: 78px;
+}
+/* amount */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(6){
+    width: 133px;
+}
+/* TOTAL */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(7){
+    width: 133px;
+}
+
+/* Task Id */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(8){
+    display: none;
+}
+/* Task Line Id */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(9){
+    display: none;
+}
+/* Oum Id */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(10){
+    display: none;
+}
+/* Type */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(11){
+    display: none;
+}
+/* contractor */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(12){
+    display: none;
+}
+/* orderLine */
+.expired-account-modal .select-task-table table tbody tr td:nth-child(13){
+    display: none;
+}
+
+/***********************
+|    Invoice Expenses  |
+***********************/
+.select-task-expenses-table {
+    margin-top: 0px !important;
+}
+.expired-account-modal .modal-head-wrapper-select-task-expenses{
+    width: 100%;
+}
+.expired-account-modal .modal-itemmodal-item-select-task-expenses {
+    width: 100%;
+    height: 400px;
+    overflow-y: auto;
+}
+
+/*    TABLE     */
+.expired-account-modal .select-task-expenses-table table thead tr {
+    height: 40px !important;
+}
+/* Codigo */
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(2){
+    width: 83px;
+    text-align: right;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Descripción */
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(3){
+    width: 325px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Total  */
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(4){
+    width: 110px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Expense */
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(5){
+    width: 110px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/* Residual */
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(6){
+    width: 110px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+.expired-account-modal .select-task-expenses-table table thead tr th:nth-child(7){
+    display: none;
+}
+
+/* Table Body  */
+.expired-account-modal .select-task-expenses-table table tbody tr {
+    height: 35px;
+}
+/* SELECT */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(1){
+    width: 33px;
+}
+/* CODIGO */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(2){
+    width: 50px;
+}
+/* Descripción */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(3){
+    width: 325px;
+}
+/* UN */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(4){
+    width: 110px;
+}
+/* QTY */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(5){
+    width: 110px;
+}
+/* amount */
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(6){
+    width: 95px;
+}
+.expired-account-modal .select-task-expenses-table table tbody tr td:nth-child(7){
+    display: none;
+}
+.invoice-task-total {
+    width: 90px
+}
+.invoice-task-expenses {
+    width: 90px
+}
+.invoice-task-residual {
+    width: 90px
+}
+
+/*********************
+|     footer         |
+*********************/
+/* button */
+.select-task-footer{
+    padding-top: 10px;
+    padding-bottom: 10px;
+}
+.select-task-button {
+    font-size: 12pt !important;
+    width: 130px;
+    height: 35px;
+}

+ 442 - 0
static/src/js/eiru_civil_engineering.js

@@ -0,0 +1,442 @@
+(function() {
+    openerp.widgetInstanceEiruAddTask = null;
+    openerp.parentInstanceEiruAddTask = null;
+    var Qweb = openerp.web.qweb;
+    var instance = openerp;
+    var instanceWeb = openerp.web;
+
+    openerp.EiruAddTask = instance.Widget.extend({
+        template: 'eiruCivil.AddTask',
+        id: undefined,
+
+        eiruTasks: [],
+        currencyFormat: [],
+
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        start: function() {
+            var self = this;
+
+            this.$el.click(function(){
+                self.fectchInitial()
+            });
+            self.buttons.click(function(e) {
+                /* E (Editar) */
+                if (e.target.accessKey === 'E')
+                    self.$el.css('display','none');
+                /* S (Guarrdar) */
+                if (e.target.accessKey === 'S')
+                    self.$el.css('display','flex');
+                /* D (Cancelar) */
+                if (e.target.accessKey === 'D')
+                    self.$el.css('display','flex');
+                /* CREAR */
+                if (e.target.accessKey === 'C')
+                    self.$el.css('display','none');
+            });
+        },
+        updateId: function(id) {
+            var self = this;
+            self.id = id;
+
+            self.$el.css('display','flex');
+            if (!id)
+                self.$el.css('display','none');
+        },
+        /* Remover */
+        removeModal: function() {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
+        },
+        /* Reloada */
+        reloadPage: function() {
+            openerp.parentInstanceEiruAddTask.reload();
+        },
+        /* Metodo Inicial */
+        fectchInitial: function() {
+            var self = this;
+
+            self.fetchTask().then(function(eiruTasks) {
+                return eiruTasks;
+            }).then(function(eiruTasks) {
+                self.eiruTasks = eiruTasks;
+                return self.fetchCurrencyOrder();
+            }).then(function(currencyFormat) {
+                self.currencyFormat = currencyFormat;
+                return self.showTaskSelected()
+            });
+        },
+        /* GET task */
+        fetchTask: function() {
+            var self = this;
+            var task = new openerp.web.Model('construction.task')
+            return task.call('get_construction_task',[self.id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+        /* GET CURRENCY ORDER */
+        fetchCurrencyOrder: function() {
+            var self = this;
+            var task = new openerp.web.Model('construction.order')
+            return task.call('get_currency_order',[self.id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+
+        /* Modal */
+        showTaskSelected: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var state = true;
+            var modal = Qweb.render('eiruTasks.Modal',{'tasks': self.eiruTasks});
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal();
+
+            var tableRow = $('.expired-account-modal').find('.table-tbody').find('tr');
+            var buttonAccept = $('.expired-account-modal').find('.button-accept');
+
+            _.each(tableRow, function(tr) {
+                if (($($(tr).children()[0]).find('.select-task-item'))[0].checked) {
+                    $(tr).addClass('selected-task');
+                    ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                    $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                    $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                    $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+
+                    if (($(tr).children()[10].textContent).trim() !== 'task'){
+                        $($($(tr).children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                        $($($(tr).children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+                    }
+                    /* Format */
+                    formatInput = {'thousandsSeparator': '.', 'decimalPlaces': 2, 'decimalSeparator':','}
+                    var qtyInput = ($($(tr).children()[4]).find('.task-qty'));
+                    var amountInput = ($($(tr).children()[5]).find('.task-amount'));
+                    var amountInputTotal = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                    // var qtyInput = $($(e.target).closest('tr').children()[4]).find('.task-qty');
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    qtyInput.val(instanceWeb.formatCurrency(qty, formatInput))
+
+                    // var amountInput = $($(e.target).closest('tr').children()[5]).find('.task-amount');
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    amountInput.val(instanceWeb.formatCurrency(amount, self.currencyFormat))
+
+                    // var amountInputTotal = $($(e.target).closest('tr').children()[6]).find('.task-amoutn-total');
+                    var amountTotal = instanceWeb.unFormatCurrency( amountInputTotal.val());
+                    amountInputTotal.val(instanceWeb.formatCurrency(amountTotal, self.currencyFormat))
+
+                }
+                if (($(tr).children()[10].textContent).trim() === 'task') {
+                    $(tr).addClass('task-header-line');
+                }
+            })
+
+            /* CLICK */
+            tableRow.click(function(e) {
+                if (($(e.target).index() !== 0) ||(($(e.target).index() === 0) && ($(e.target)[0].className !== 'select-task-item')))
+                    return false;
+
+                var typeTask = ($(e.target).closest('tr').children()[10].textContent).trim();
+                var idTask = parseInt(($(e.target).closest('tr').children()[7].textContent).trim());
+                var idTaskLine = parseInt(($(e.target).closest('tr').children()[8].textContent).trim());
+
+                if (typeTask === 'task') {
+                    if (e.target.checked === true) {
+                        _.each(tableRow, function(tr) {
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            if (taskID === idTask ) {
+                                /* SELECT */
+                                $(tr).addClass('selected-task');
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                                $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+
+                                if (!!lineID) {
+                                    $($($(tr).children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                                    $($($(tr).children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+                                }
+                            }
+                        })
+                    } else {
+                        _.each(tableRow, function(tr) {
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            if (taskID === idTask) {
+                                $(tr).removeClass('selected-task');
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=false;
+                                /* QTY */
+                                $($($(tr).children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                                $($($(tr).children()[4]).find('.task-qty')[0]).attr("disabled", true);
+                                /* AMOUNT */
+                                $($($(tr).children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).attr("disabled", true);
+                                /* TOTAL */
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+
+                                ($($(tr).children()[4]).find('.task-qty')).val(0);
+                                ($($(tr).children()[5]).find('.task-amount')).val(0);
+                                ($($(tr).children()[6]).find('.task-amoutn-total')).val(0);
+
+                            }
+                        })
+                    }
+                } else {
+                    if (e.target.checked === true) {
+                        $(e.target).closest('tr').addClass('selected-task');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+
+                        ($($(e.target).closest('tr').children()[4]).find('.task-qty')).focus();
+
+                        _.each(tableRow,function(tr){
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            if ((taskID === idTask) && (!lineID)) {
+                                $(tr).addClass('selected-task');
+                                //     /* SELECTED */
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                                $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+                            }
+                        });
+                    } else {
+                        $(e.target).closest('tr').removeClass('selected-task');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).attr("disabled", true);
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).attr("disabled", true);
+                        $($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+
+                        ($($(e.target).closest('tr').children()[4]).find('.task-qty')).val(0);
+                        ($($(e.target).closest('tr').children()[5]).find('.task-amount')).val(0);
+                        ($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')).val(0);
+
+                        var stateSelect = false;
+                        _.each(tableRow,function(tr){
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            if ((taskID === idTask) && (!lineID)) {
+                                var totalAmount = 0
+                                _.each(tableRow,function(tr){
+                                    if ((parseInt(($(tr).children()[7].textContent).trim()) === idTask) && (!! parseInt(($(tr).children()[8].textContent).trim()))) {
+                                        if (!!(($($(tr).children()[0]).find('.select-task-item'))[0].checked)){
+                                            stateSelect = ($($(tr).children()[0]).find('.select-task-item'))[0].checked;
+                                            var qty = ($($(tr).children()[4]).find('.task-qty'));
+                                            var amount = ($($(tr).children()[5]).find('.task-amount'));
+                                            var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                                            total.val(instanceWeb.formatCurrency((instanceWeb.unFormatCurrency(qty.val()) * instanceWeb.unFormatCurrency(amount.val())), self.currencyFormat));
+                                            /* Total */
+                                            totalAmount += instanceWeb.unFormatCurrency(total.val());
+                                        }
+                                    }
+                                });
+                                if (!stateSelect){
+                                    ($($(tr).children()[0]).find('.select-task-item'))[0].checked = false;
+                                    $(tr).removeClass('selected-task');
+                                    $($($(tr).children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                                    $($($(tr).children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                                    $($($(tr).children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+                                }
+                                ($($(tr).children()[4]).find('.task-qty')).val(0);
+                                ($($(tr).children()[5]).find('.task-amount')).val(0);
+                                ($($(tr).children()[6]).find('.task-amoutn-total')).val(instanceWeb.formatCurrency(totalAmount, self.currencyFormat));
+                            }
+                        });
+                    }
+                }
+            });
+
+            // FOCUSIN
+            tableRow.focusin(function(e){
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount')))
+                    return false;
+
+                var qtyInput = $($(e.target).closest('tr').children()[4]).find('.task-qty');
+                var amountInput = $($(e.target).closest('tr').children()[5]).find('.task-amount');
+                var nameClase = ($(e.target)[0].className).trim().split(" ");
+                /* QTY */
+                if (_.contains(nameClase, 'task-qty')) {
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    if (qty === 0)
+                        qtyInput.val('');
+                }
+                /* Precio Unitario*/
+                if (_.contains(nameClase, 'task-amount')) {
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    if (amount === 0)
+                        amountInput.val('');
+                }
+            });
+
+            /* KEYUP */
+            tableRow.keyup(function(e) {
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount'))){
+                    return false;
+                }
+                var qtyInput = $($(e.target).closest('tr').children()[4]).find('.task-qty');
+                var amountInput = $($(e.target).closest('tr').children()[5]).find('.task-amount');
+                var totalInput = $($(e.target).closest('tr').children()[6]).find('.task-amoutn-total');
+                var nameClase = ($(e.target)[0].className).trim().split(" ");
+                /* QTY */
+                if (_.contains(nameClase, 'task-qty')) {
+
+                    formatInput = {
+                        'thousandsSeparator': '.',
+                        'decimalPlaces': 2,
+                        'decimalSeparator':','
+                    }
+
+                    if (e.key === formatInput.decimalSeparator && formatInput.decimalPlaces > 0)
+                        return
+
+
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    qty = instanceWeb.formatCurrency(qty, formatInput)
+                    qtyInput.val(qty)
+                }
+
+                /* AMOUNT */
+                if (_.contains(nameClase, 'task-amount')) {
+
+                    if (e.key === self.currencyFormat.decimalSeparator && self.currencyFormat.decimalPlaces > 0)
+                        return
+
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    amount = instanceWeb.formatCurrency(amount, self.currencyFormat)
+                    amountInput.val(amount)
+                }
+            });
+
+            /* FOCUS OUT */
+            tableRow.focusout(function(e) {
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount'))){
+                    return false;
+                }
+
+                var idTask = parseInt(($(e.target).closest('tr').children()[7].textContent).trim());
+                _.each(tableRow,function(tr){
+                    taskID = parseInt(($(tr).children()[7].textContent).trim())
+                    lineID = parseInt(($(tr).children()[8].textContent).trim())
+
+                    if ((taskID === idTask) && (!lineID)) {
+                        var totalTask = ($($(tr).children()[6]).find('.task-amoutn-total'))
+                        var totalAmount = 0;
+                        _.each(tableRow,function(tr){
+                            if ((parseInt(($(tr).children()[7].textContent).trim()) === idTask) && (!! parseInt(($(tr).children()[8].textContent).trim()))) {
+                                if (!!(($($(tr).children()[0]).find('.select-task-item'))[0].checked)){
+                                    var qty = ($($(tr).children()[4]).find('.task-qty'));
+                                    var amount = ($($(tr).children()[5]).find('.task-amount'));
+                                    var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                                    total.val(instanceWeb.formatCurrency((instanceWeb.unFormatCurrency(qty.val()) * instanceWeb.unFormatCurrency(amount.val())), self.currencyFormat));
+                                    /* Total */
+                                    totalAmount += instanceWeb.unFormatCurrency(total.val());
+                                }
+                            }
+                        });
+                        totalTask.val(instanceWeb.formatCurrency(totalAmount, self.currencyFormat));
+                    }
+                });
+            });
+
+            /* GUARDAR */
+            buttonAccept.click(function(e){
+                var orderTask = [];
+                _.each(tableRow, function(tr) {
+
+                    if ( ($($(tr).children()[0]).find('.select-task-item'))[0].checked ) {
+
+                        var qty = ($($(tr).children()[4]).find('.task-qty'));
+                        var amount = ($($(tr).children()[5]).find('.task-amount'));
+                        var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                        orderTask.push({
+                            'code': ($(tr).children()[1].textContent).trim(),
+                            'taskName': ($(tr).children()[2].textContent).trim(),
+                            'qty': instanceWeb.unFormatCurrency(qty.val()),
+                            'amount': instanceWeb.unFormatCurrency(amount.val()),
+                            'amountTotal': instanceWeb.unFormatCurrency(total.val()),
+                            'taskId': ($(tr).children()[7].textContent).trim(),
+                            'taskLineId': ($(tr).children()[8].textContent).trim(),
+                            'uomId': ($(tr).children()[9].textContent).trim(),
+                            'type': ($(tr).children()[10].textContent).trim(),
+                            // 'orderIds' : self.id,
+                        })
+                    }
+                });
+
+                if (!orderTask.length) {
+                    instanceWeb.notification.do_warn("Atencion", "Debes seleccionar al menos una tarea.");
+                    return
+                }
+
+                self.addtask(orderTask).then(function(taskAdd) {
+                    return taskAdd;
+                }).then(function(taskAdd) {
+                    state = taskAdd.state;
+                    // instanceWeb.notification.do_warn("Atencion", taskAdd.message);
+                    self.reloadPage();
+                    self.removeModal(e);
+                });
+
+                defer.resolve(state);
+            });
+
+            /* Click Cerrar */
+            $('.expired-account-modal').on('hidden.bs.modal', function (e) {
+                defer.resolve(false);
+                self.removeModal(e);
+            });
+
+            return defer;
+        },
+        /*actualizar line order */
+        addtask: function(tasks){
+            var self = this;
+            var order = new instance.web.Model('construction.order');
+            return order.call('eiru_add_task',[self.id, tasks], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+    });
+
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'construction.order')
+                    return;
+
+                openerp.parentInstanceEiruAddTask = this;
+
+                if (openerp.widgetInstanceEiruAddTask) {
+                    openerp.widgetInstanceEiruAddTask.updateId(record.id);
+                    if (this.$el.find('.button-add-task').length !== 0){
+                        return
+                    }
+                }
+
+                if (this.$el.find('.button-add-task').length !== 0 )
+                    return;
+
+                openerp.widgetInstanceEiruAddTask = new openerp.EiruAddTask(this);
+                var elemento = this.$el.find('.oe_form').find('.eiru-add-task');
+
+                openerp.widgetInstanceEiruAddTask.appendTo(elemento);
+                openerp.widgetInstanceEiruAddTask.updateId(record.id);
+
+            },
+    
+        });
+    }
+})();

+ 569 - 0
static/src/js/eiru_civil_engineering_contractor.js

@@ -0,0 +1,569 @@
+(function() {
+    openerp.widgetInstanceEiruAddTaskContractor = null;
+    openerp.parentInstanceEiruAddTaskContractor = null;
+    var Qweb = openerp.web.qweb;
+    var instance = openerp;
+    var instanceWeb = openerp.web;
+
+    openerp.EiruAddTaskContractor = instance.Widget.extend({
+        template: 'eiruCivilAddTask.Contractor',
+        id: undefined,
+
+        taskOrder: [],
+        currencyFormat: [],
+
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        start: function() {
+            var self = this;
+
+            this.$el.click(function(){
+                self.fectchInitial()
+            });
+            self.buttons.click(function(e) {
+                /* E (Editar) */
+                if (e.target.accessKey === 'E')
+                    self.$el.css('display','none');
+                /* S (Guarrdar) */
+                if (e.target.accessKey === 'S')
+                    self.$el.css('display','flex');
+                /* D (Cancelar) */
+                if (e.target.accessKey === 'D')
+                    self.$el.css('display','flex');
+                /* CREAR */
+                if (e.target.accessKey === 'C')
+                    self.$el.css('display','none');
+            });
+        },
+        updateId: function(id) {
+            var self = this;
+            self.id = id;
+
+            self.$el.css('display','flex');
+            if (!id)
+                self.$el.css('display','none');
+        },
+        /* Remover */
+        removeModal: function() {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
+        },
+        /* Reloada */
+        reloadPage: function() {
+            openerp.parentInstanceEiruAddTaskContractor.reload();
+        },
+        /* Metodo Inicial */
+        fectchInitial: function() {
+            var self = this;
+
+            self.fetchTaskOrder().then(function(taskOrder) {
+                return taskOrder;
+            }).then(function(taskOrder) {
+                self.taskOrder = taskOrder;
+                return self.fetchCurrencyBudget();
+            }).then(function(currencyFormat) {
+                self.currencyFormat = currencyFormat;
+                return self.showTaskSelectedTask()
+            });
+        },
+        /* GET task */
+        fetchTaskOrder: function() {
+            var self = this;
+            var task = new openerp.web.Model('construction.task')
+            return task.call('get_task_order',[self.id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+        /* GET CURRENCY ORDER */
+        fetchCurrencyBudget: function() {
+            var self = this;
+            var budget = new openerp.web.Model('construction.order.contractor')
+            return budget.call('get_currency_budget',[self.id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+
+        /* Modal */
+        showTaskSelectedTask: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var state = true;
+            var modal = Qweb.render('eiruTasksOrder.Modal',{'tasks': self.taskOrder});
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal();
+
+            var tableRow = $('.expired-account-modal').find('.table-tbody').find('tr');
+            var buttonAccept = $('.expired-account-modal').find('.button-accept');
+
+            /*----------
+            |    INIT   |
+            -----------*/
+            _.each(tableRow, function(tr) {
+                if (($($(tr).children()[0]).find('.select-task-item'))[0].checked) {
+                    $(tr).addClass('selected-task');
+                    ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                    $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                    $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                    $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+
+                    if (($(tr).children()[10].textContent).trim() !== 'task'){
+                        $($($(tr).children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                        // $($($(tr).children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+                    }
+                    /* Format */
+                    var formatInput = {'thousandsSeparator': '.', 'decimalPlaces': 2, 'decimalSeparator':','}
+                    var qtyInput = ($($(tr).children()[4]).find('.task-qty'));
+                    var amountInput = ($($(tr).children()[5]).find('.task-amount'));
+                    var amountInputTotal = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    qtyInput.val(instanceWeb.formatCurrency(qty, formatInput))
+
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    amountInput.val(instanceWeb.formatCurrency(amount, self.currencyFormat))
+
+                    var amountTotal = instanceWeb.unFormatCurrency( amountInputTotal.val());
+                    amountInputTotal.val(instanceWeb.formatCurrency(amountTotal, self.currencyFormat))
+                }
+
+                /* verifica si ya existe en otro contractista */
+                var contractor = ($(tr).children()[11].textContent).trim();
+                if ((!!contractor) && (parseInt(contractor) != self.id)) {
+                    // ($($(tr).children()[0]).find('.select-task-item'))[0].checked = false;
+                    $($($(tr).children()[0]).find('.select-task-item')[0]).attr("disabled", true);
+                    $($($(tr).children()[5]).find('.task-amount')[0]).attr("disabled", true);
+                    $($($(tr).children()[4]).find('.task-qty')[0]).attr("disabled", true);
+                    $(tr).removeClass('selected-task');
+                    $(tr).addClass('disabled-task');
+
+                    qtyInput.val(0)
+                    amountInput.val(0)
+                    amountInputTotal.val(0)
+                }
+
+                if (($(tr).children()[10].textContent).trim() === 'task') {
+                    $(tr).addClass('task-header-line');
+
+                    var isDisable = true;
+                    var taskID = parseInt(($(tr).children()[7].textContent).trim());
+                    var stateHeader = (($($(tr).children()[0]).find('.select-task-item'))[0].checked);
+                    var stateNotOrder = false;
+                    var stateOrder = false;
+                    // var total = 0;
+
+                    _.each(tableRow,function(tr) {
+                        lineTaskID = parseInt(($(tr).children()[7].textContent).trim())
+                        lineID = parseInt(($(tr).children()[8].textContent).trim())
+                        // var amountInputTotal = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                        // total += instanceWeb.unFormatCurrency(amountInputTotal.val());
+                        if ((taskID === lineTaskID) && (!!lineID)) {
+                            var contractor = ($(tr).children()[11].textContent).trim();
+                            if (stateHeader) {
+                                isDisable = (($($(tr).children()[0]).find('.select-task-item'))[0].checked) && !!isDisable ? true: false;
+                                if (($($(tr).children()[0]).find('.select-task-item'))[0].checked) {
+                                    if ((parseInt(contractor) !== self.id)) {
+                                        stateNotOrder = true
+                                    }
+                                    if ((parseInt(contractor) === self.id)) {
+                                        stateOrder = true
+                                    }
+                                }
+                            }
+                        }
+                    })
+
+                    // $($(tr).children()[6]).find('.task-amoutn-total').val(instanceWeb.formatCurrency(total, self.currencyFormat))
+                    if (stateNotOrder && !isDisable) {
+                        $(tr).removeClass('disabled-task');
+                        ($($(tr).children()[0]).find('.select-task-item'))[0].checked = false;
+                        $($($(tr).children()[0]).find('.select-task-item')[0]).removeAttr("disabled");
+                        $($(tr).children()[11]).text('')
+                    }
+
+                    if (stateOrder) {
+                        $(tr).removeClass('disabled-task');
+                        $(tr).addClass('selected-task');
+
+                        ($($(tr).children()[0]).find('.select-task-item'))[0].checked = true;
+                        $($($(tr).children()[0]).find('.select-task-item')[0]).removeAttr("disabled");
+                        $($(tr).children()[11]).text('')
+                    }
+                }
+            });
+            /*------------------------
+            |   Update Total         |
+            ------------------------*/
+            _.each(tableRow,function(tr){
+                var taskID = parseInt(($(tr).children()[7].textContent).trim())
+                // var lineID = parseInt(($(tr).children()[8].textContent).trim())
+                var typeSelect = ($(tr).children()[10].textContent).trim();
+
+
+
+
+                if (typeSelect === 'task') {
+                    var totalTask = ($($(tr).children()[6]).find('.task-amoutn-total'))
+                    var totalAmount = 0;
+
+                    _.each(tableRow,function(tr) {
+                        var idTask = parseInt(($(tr).children()[7].textContent).trim())
+                        var lineID = parseInt(($(tr).children()[8].textContent).trim())
+
+                        // if (typeSelect === 'activity') {
+                        if ((taskID === idTask) && (!!lineID)) {
+                            if (!!(($($(tr).children()[0]).find('.select-task-item'))[0].checked)){
+                                // var qty = ($($(tr).children()[4]).find('.task-qty'));
+                                // var amount = ($($(tr).children()[5]).find('.task-amount'));
+                                var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                                // total.val(instanceWeb.formatCurrency((instanceWeb.unFormatCurrency(qty.val()) * instanceWeb.unFormatCurrency(amount.val())), self.currencyFormat));
+                                /* Total */
+                                totalAmount += instanceWeb.unFormatCurrency(total.val());
+                            }
+                        }
+                    });
+
+                    totalTask.val(instanceWeb.formatCurrency(totalAmount, self.currencyFormat));
+                }
+            });
+
+            /*-------------
+            |    CLICK    |
+            -------------*/
+            tableRow.click(function(e) {
+                if (($(e.target).index() !== 0) ||(($(e.target).index() === 0) && ($(e.target)[0].className !== 'select-task-item')))
+                    return false;
+
+                var typeTask = ($(e.target).closest('tr').children()[10].textContent).trim();
+                var idTask = parseInt(($(e.target).closest('tr').children()[7].textContent).trim());
+                var idTaskLine = parseInt(($(e.target).closest('tr').children()[8].textContent).trim());
+
+                if (typeTask === 'task') {
+                    if (e.target.checked === true) {
+                        _.each(tableRow, function(tr) {
+                            var taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            var lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            var contractor = ($(tr).children()[11].textContent).trim();
+                            var typeSelect = ($(tr).children()[10].textContent).trim();
+
+                            if (taskID === idTask ) {
+                                if ((!!contractor) && (parseInt(contractor) != self.id) && (typeSelect === 'activity'))
+                                    return
+
+                                /* SELECT */
+                                $(tr).addClass('selected-task');
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                                $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+
+                                if (!!lineID) {
+                                    $($($(tr).children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                                    // $($($(tr).children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+                                }
+                            }
+                        })
+                    } else {
+                        _.each(tableRow, function(tr) {
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            if (taskID === idTask) {
+                                var contractor = ($(tr).children()[11].textContent).trim();
+                                var typeSelect = ($(tr).children()[10].textContent).trim();
+
+                                if ((!!contractor) && (parseInt(contractor) != self.id) && (typeSelect === 'activity'))
+                                        return
+
+                                $(tr).removeClass('selected-task');
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=false;
+                                /* QTY */
+                                $($($(tr).children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                                $($($(tr).children()[4]).find('.task-qty')[0]).attr("disabled", true);
+                                /* AMOUNT */
+                                $($($(tr).children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).attr("disabled", true);
+                                /* TOTAL */
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+
+                                // ($($(tr).children()[4]).find('.task-qty')).val(0);
+                                ($($(tr).children()[5]).find('.task-amount')).val(0);
+                                ($($(tr).children()[6]).find('.task-amoutn-total')).val(0);
+
+                            }
+                        })
+                    }
+                } else {
+                    if (e.target.checked === true) {
+                        $(e.target).closest('tr').addClass('selected-task');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).removeAttr("disabled");
+                        // $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).removeAttr("disabled");
+
+                        ($($(e.target).closest('tr').children()[5]).find('.task-amount')).focus();
+
+                        _.each(tableRow,function(tr){
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            if ((taskID === idTask) && (!lineID)) {
+                                $(tr).addClass('selected-task');
+                                /* SELECTED */
+                                ($($(tr).children()[0]).find('.select-task-item'))[0].checked=true;
+                                $($($(tr).children()[4]).find('.task-qty')[0]).addClass('task-input-in');
+                                $($($(tr).children()[5]).find('.task-amount')[0]).addClass('task-input-in');
+                                $($($(tr).children()[6]).find('.task-amoutn-total')[0]).addClass('task-input-in');
+                            }
+                        });
+                    } else {
+                        $(e.target).closest('tr').removeClass('selected-task');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[4]).find('.task-qty')[0]).attr("disabled", true);
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                        $($($(e.target).closest('tr').children()[5]).find('.task-amount')[0]).attr("disabled", true);
+                        $($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+
+                        // ($($(e.target).closest('tr').children()[4]).find('.task-qty')).val(0);
+                        ($($(e.target).closest('tr').children()[5]).find('.task-amount')).val(0);
+                        ($($(e.target).closest('tr').children()[6]).find('.task-amoutn-total')).val(0);
+
+                        var stateSelect = false;
+                        _.each(tableRow,function(tr){
+                            taskID = parseInt(($(tr).children()[7].textContent).trim())
+                            lineID = parseInt(($(tr).children()[8].textContent).trim())
+                            if ((taskID === idTask) && (!lineID)) {
+                                var totalAmount = 0
+                                _.each(tableRow,function(tr){
+                                    var contractor = ($(tr).children()[11].textContent).trim();
+                                    var typeSelect = ($(tr).children()[10].textContent).trim();
+                                    if ((parseInt(($(tr).children()[7].textContent).trim()) === idTask) && (!! parseInt(($(tr).children()[8].textContent).trim()))) {
+                                        if (!!(($($(tr).children()[0]).find('.select-task-item'))[0].checked)){
+                                            var qty = ($($(tr).children()[4]).find('.task-qty'));
+                                            var amount = ($($(tr).children()[5]).find('.task-amount'));
+                                            var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                                            total.val(instanceWeb.formatCurrency((instanceWeb.unFormatCurrency(qty.val()) * instanceWeb.unFormatCurrency(amount.val())), self.currencyFormat));
+                                            /* Total */
+                                            totalAmount += instanceWeb.unFormatCurrency(total.val());
+
+                                            if ((!!contractor) && (parseInt(contractor) != self.id) && (typeSelect === 'activity'))
+                                                return
+
+                                            stateSelect = ($($(tr).children()[0]).find('.select-task-item'))[0].checked;
+                                        }
+                                    }
+                                });
+                                if (!stateSelect){
+                                    ($($(tr).children()[0]).find('.select-task-item'))[0].checked = false;
+                                    $(tr).removeClass('selected-task');
+                                    $($($(tr).children()[4]).find('.task-qty')[0]).removeClass('task-input-in');
+                                    $($($(tr).children()[5]).find('.task-amount')[0]).removeClass('task-input-in');
+                                    $($($(tr).children()[6]).find('.task-amoutn-total')[0]).removeClass('task-input-in');
+                                }
+                                // ($($(tr).children()[4]).find('.task-qty')).val(0);
+                                ($($(tr).children()[5]).find('.task-amount')).val(0);
+                                ($($(tr).children()[6]).find('.task-amoutn-total')).val(instanceWeb.formatCurrency(totalAmount, self.currencyFormat));
+                            }
+                        });
+                    }
+                }
+            });
+
+            /* ---------------
+            |   FOCUSIN      |
+            --------------- */
+            tableRow.focusin(function(e){
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount')))
+                    return false;
+
+                var qtyInput = $($(e.target).closest('tr').children()[4]).find('.task-qty');
+                var amountInput = $($(e.target).closest('tr').children()[5]).find('.task-amount');
+                var nameClase = ($(e.target)[0].className).trim().split(" ");
+                /* QTY */
+                if (_.contains(nameClase, 'task-qty')) {
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    if (qty === 0)
+                        qtyInput.val('');
+                }
+                /* Precio Unitario*/
+                if (_.contains(nameClase, 'task-amount')) {
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    if (amount === 0)
+                        amountInput.val('');
+                }
+            });
+
+            /*---------------
+            |    KEYUP      |
+            ---------------*/
+            tableRow.keyup(function(e) {
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount')))
+                    return false;
+
+                var qtyInput = $($(e.target).closest('tr').children()[4]).find('.task-qty');
+                var amountInput = $($(e.target).closest('tr').children()[5]).find('.task-amount');
+                var totalInput = $($(e.target).closest('tr').children()[6]).find('.task-amoutn-total');
+                var nameClase = ($(e.target)[0].className).trim().split(" ");
+
+                /* QTY */
+                if (_.contains(nameClase, 'task-qty')) {
+                    formatInput = {
+                        'thousandsSeparator': '.',
+                        'decimalPlaces': 2,
+                        'decimalSeparator':','
+                    }
+
+                    if (e.key === formatInput.decimalSeparator && formatInput.decimalPlaces > 0)
+                        return
+
+                    var qty = instanceWeb.unFormatCurrency( qtyInput.val());
+                    qty = instanceWeb.formatCurrency(qty, formatInput)
+                    qtyInput.val(qty)
+                }
+
+                /* AMOUNT */
+                if (_.contains(nameClase, 'task-amount')) {
+
+                    if (e.key === self.currencyFormat.decimalSeparator && self.currencyFormat.decimalPlaces > 0)
+                        return
+
+                    var amount = instanceWeb.unFormatCurrency( amountInput.val());
+                    amount = instanceWeb.formatCurrency(amount, self.currencyFormat)
+                    amountInput.val(amount)
+                }
+            });
+
+            /*---------------
+            |   FOCUS OUT   |
+            ---------------*/
+            tableRow.focusout(function(e) {
+                if (($(e.target).index() !== 0) && (($(e.target)[0].className !== 'task-qty') || ($(e.target)[0].className !== 'task-amount')))
+                    return false;
+
+                var idTask = parseInt(($(e.target).closest('tr').children()[7].textContent).trim());
+                _.each(tableRow,function(tr){
+                    taskID = parseInt(($(tr).children()[7].textContent).trim())
+                    lineID = parseInt(($(tr).children()[8].textContent).trim())
+
+                    if ((taskID === idTask) && (!lineID)) {
+                        var totalTask = ($($(tr).children()[6]).find('.task-amoutn-total'))
+                        var totalAmount = 0;
+
+                        _.each(tableRow,function(tr){
+                            if ((parseInt(($(tr).children()[7].textContent).trim()) === idTask) && (!! parseInt(($(tr).children()[8].textContent).trim()))) {
+                                if (!!(($($(tr).children()[0]).find('.select-task-item'))[0].checked)){
+                                    var qty = ($($(tr).children()[4]).find('.task-qty'));
+                                    var amount = ($($(tr).children()[5]).find('.task-amount'));
+                                    var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                                    total.val(instanceWeb.formatCurrency((instanceWeb.unFormatCurrency(qty.val()) * instanceWeb.unFormatCurrency(amount.val())), self.currencyFormat));
+                                    /* Total */
+                                    totalAmount += instanceWeb.unFormatCurrency(total.val());
+                                }
+                            }
+                        });
+                        totalTask.val(instanceWeb.formatCurrency(totalAmount, self.currencyFormat));
+                    }
+                });
+            });
+
+            /*---------------
+            |   GUARDAR     |
+            ---------------*/
+            buttonAccept.click(function(e){
+                var orderTask = [];
+                _.each(tableRow, function(tr) {
+                    var contractor = ($(tr).children()[11].textContent).trim()
+                    if ( (($($(tr).children()[0]).find('.select-task-item'))[0].checked) && ((!contractor) || (parseInt(contractor) === self.id)) ) {
+
+                        var qty = ($($(tr).children()[4]).find('.task-qty'));
+                        var amount = ($($(tr).children()[5]).find('.task-amount'));
+                        var total = ($($(tr).children()[6]).find('.task-amoutn-total'));
+
+                    orderTask.push({
+                            'code': ($(tr).children()[1].textContent).trim(),
+                            'taskName': ($(tr).children()[2].textContent).trim(),
+                            'qty': instanceWeb.unFormatCurrency(qty.val()),
+                            'amount': instanceWeb.unFormatCurrency(amount.val()),
+                            'amountTotal': instanceWeb.unFormatCurrency(total.val()),
+                            'taskId': ($(tr).children()[7].textContent).trim(),
+                            'taskLineId': ($(tr).children()[8].textContent).trim(),
+                            'uomId': ($(tr).children()[9].textContent).trim(),
+                            'type': ($(tr).children()[10].textContent).trim(),
+                            // 'orderLine' : parseInt(($(tr).children()[12].textContent).trim()),
+                        })
+                    }
+                });
+
+                if (!orderTask.length) {
+                    instanceWeb.notification.do_warn("Atencion", "Debes seleccionar al menos una tarea.");
+                    // return
+                }
+
+                self.addTaskContractor(orderTask).then(function(taskAdd) {
+                    return taskAdd;
+                }).then(function(taskAdd) {
+                    state = taskAdd.state;
+                    // instanceWeb.notification.do_warn("Atencion", taskAdd.message);
+                    self.reloadPage();
+                    self.removeModal(e);
+                });
+
+                defer.resolve(state);
+            });
+
+            /* Click Cerrar */
+            $('.expired-account-modal').on('hidden.bs.modal', function (e) {
+                defer.resolve(false);
+                self.removeModal(e);
+            });
+
+            return defer;
+        },
+
+        /*-------------------
+        | ADD TASK IN LINE  |
+        -------------------*/
+        addTaskContractor: function(tasks){
+            var self = this;
+            var contractor = new instance.web.Model('construction.order.contractor');
+            return contractor.call('add_task_contractor',[self.id, tasks], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+    });
+
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'construction.order.contractor')
+                    return;
+
+                openerp.parentInstanceEiruAddTaskContractor = this;
+
+                if (openerp.widgetInstanceEiruAddTaskContractor) {
+                    openerp.widgetInstanceEiruAddTaskContractor.updateId(record.id);
+                    if (this.$el.find('.button-add-task-contractor').length !== 0){
+                        return
+                    }
+                }
+
+                if (this.$el.find('.button-add-task-contractor').length !== 0 )
+                    return;
+
+                openerp.widgetInstanceEiruAddTaskContractor = new openerp.EiruAddTaskContractor(this);
+                var elemento = this.$el.find('.oe_form').find('.eiru-add-task-contractor');
+
+                openerp.widgetInstanceEiruAddTaskContractor.appendTo(elemento);
+                openerp.widgetInstanceEiruAddTaskContractor.updateId(record.id);
+
+            },
+
+        });
+    }
+})();

+ 220 - 0
static/src/js/eiru_civil_invoice_task_expenses.js

@@ -0,0 +1,220 @@
+(function() {
+
+    openerp.widgetInstanceEiruAddInvoiceTaskExpenses = null;
+    openerp.parentInstanceEiruAddInvoiceTaskExpenses = null;
+    var Qweb = openerp.web.qweb;
+    var instance = openerp;
+    var instanceWeb = openerp.web;
+
+    openerp.EiruAddInvoiceTaskExpenses = instance.Widget.extend({
+        template: 'eiruAddInvoiceTask.Expenses',
+        id: undefined,
+
+        taskOrder: [],
+        currencyFormat: [],
+
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+
+        start: function() {
+            var self = this;
+
+            this.$el.click(function(){
+                self.fectchInitial()
+            });
+            self.buttons.click(function(e) {
+                /* E (Editar) */
+                if (e.target.accessKey === 'E')
+                    self.$el.css('display','none');
+                /* S (Guarrdar) */
+                if (e.target.accessKey === 'S')
+                    self.$el.css('display','flex');
+                /* D (Cancelar) */
+                if (e.target.accessKey === 'D')
+                    self.$el.css('display','flex');
+                /* CREAR */
+                if (e.target.accessKey === 'C')
+                    self.$el.css('display','none');
+            });
+        },
+
+        updateId: function(id) {
+            var self = this;
+            self.id = id;
+
+            self.$el.css('display','flex');
+            if (!id)
+                self.$el.css('display','none');
+        },
+
+        /* Remover */
+        removeModal: function() {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
+        },
+
+        /* Reloada */
+        reloadPage: function() {
+            openerp.parentInstanceEiruAddInvoiceTaskExpenses.reload();
+        },
+
+        /* Metodo Inicial */
+        fectchInitial: function() {
+            var self = this;
+            self.fetchTaskOrderExpenses(self.id).then(function(taskOrder) {
+                return taskOrder;
+            }).then(function(taskOrder) {
+                console.log(taskOrder);
+                self.taskOrder = taskOrder;
+                return self.fetchCurrencyInvoice(self.id);
+            }).then(function(currencyFormat) {
+                self.currencyFormat = currencyFormat;
+                console.log(currencyFormat);
+                return self.showTaskExpenses()
+            });
+        },
+
+        /* GET task */
+        fetchTaskOrderExpenses: function(id) {
+            var task = new openerp.web.Model('account.invoice')
+            return task.call('getAccountInvoiceOrder',[id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+
+        /* GET CURRENCY ORDER */
+        fetchCurrencyInvoice: function(id) {
+            var budget = new openerp.web.Model('account.invoice')
+            return budget.call('getCurrencyInvoceExpenses',[id],{
+                context: new openerp.web.CompoundContext()
+            });
+        },
+
+        /* Modal */
+        showTaskExpenses: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var state = true;
+            var modal = Qweb.render('eiruInvoiceTaskExpenses.Modal',{'tasks': self.taskOrder});
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal();
+
+            var tableRow = $('.expired-account-modal').find('.table-tbody').find('tr');
+            var buttonAccept = $('.expired-account-modal').find('.button-accept');
+
+            /*----------
+            |    INIT   |
+            -----------*/
+            _.each(tableRow, function(tr) {
+                var amountTotal = ($($(tr).children()[3]).find('.invoice-task-total'));
+                var amountExpenses = ($($(tr).children()[4]).find('.invoice-task-expenses'));
+                var amountResidual = ($($(tr).children()[5]).find('.invoice-task-residual'));
+
+                var total = instanceWeb.unFormatCurrency(amountTotal.val());
+                var expense = instanceWeb.unFormatCurrency(amountExpenses.val());
+                var residual = instanceWeb.unFormatCurrency(amountResidual.val());
+
+                amountTotal.val(instanceWeb.formatCurrency(total, self.currencyFormat))
+                amountExpenses.val(instanceWeb.formatCurrency(expense, self.currencyFormat))
+                amountResidual.val(instanceWeb.formatCurrency(residual, self.currencyFormat))
+            });
+
+            /*-------------
+            |    CLICK    |
+            -------------*/
+            tableRow.click(function(e) {
+                if (($(e.target).index() !== 0) ||(($(e.target).index() === 0) && ($(e.target)[0].className !== 'select-task-expenses')))
+                    return false;
+
+                $(e.target).closest('tr').removeClass('selected-task');
+                if (e.target.checked === true) {
+                    $(e.target).closest('tr').addClass('selected-task');
+                }
+            });
+
+            /*---------------
+            |   GUARDAR     |
+            ---------------*/
+            buttonAccept.click(function(e){
+                var orderTask = [];
+                _.each(tableRow, function(tr) {
+                    if (($($(tr).children()[0]).find('.select-task-expenses'))[0].checked) {
+                        orderTask.push({
+                            'code': ($(tr).children()[1].textContent).trim(),
+                            'moveLineId': parseInt(($(tr).children()[6].textContent).trim()),
+                        })
+                    }
+                });
+
+                if (!orderTask.length) {
+                    instanceWeb.notification.do_warn("Atencion", "Debes seleccionar al menos una tarea.");
+                    return
+                }
+
+                self.addTaskContractorExpenses(self.id, orderTask).then(function(taskAdd) {
+                    return taskAdd;
+                }).then(function(taskAdd) {
+                    state = taskAdd.state;
+                    if (!taskAdd.state)
+                        instanceWeb.notification.do_warn("Atencion", taskAdd.message);
+                    self.reloadPage();
+                    self.removeModal(e);
+                });
+
+                defer.resolve(state);
+            });
+
+            /* Click Cerrar */
+            $('.expired-account-modal').on('hidden.bs.modal', function (e) {
+                defer.resolve(false);
+                self.removeModal(e);
+            });
+
+            return defer;
+        },
+
+        /*-------------------
+        | ADD TASK IN LINE  |
+        -------------------*/
+        addTaskContractorExpenses: function(idInvoice,tasks) {
+            var contractor = new instance.web.Model('account.invoice');
+            return contractor.call('addTaskExpensesMove',[idInvoice, tasks], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+    });
+
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'account.invoice')
+                    return;
+
+                openerp.parentInstanceEiruAddInvoiceTaskExpenses = this;
+
+                if (openerp.widgetInstanceEiruAddInvoiceTaskExpenses) {
+                    openerp.widgetInstanceEiruAddInvoiceTaskExpenses.updateId(record.id);
+                    if (this.$el.find('.button-add-task-invoice-expenses').length !== 0){
+                        return
+                    }
+                }
+
+                if (this.$el.find('.button-add-task-invoice-expenses').length !== 0 )
+                    return;
+
+                openerp.widgetInstanceEiruAddInvoiceTaskExpenses = new openerp.EiruAddInvoiceTaskExpenses(this);
+                var elemento = this.$el.find('.oe_form').find('.eiru-task-expenses-add');
+
+                openerp.widgetInstanceEiruAddInvoiceTaskExpenses.appendTo(elemento);
+                openerp.widgetInstanceEiruAddInvoiceTaskExpenses.updateId(record.id);
+
+            },
+
+        });
+    }
+})();

+ 9 - 0
static/src/xml/add_task.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template>
+    <t t-name="eiruCivil.AddTask">
+        <button class="button-add-task oe_stat_button btn btn_default">
+            <div class="stat_button_icon fa fa-tasks"></div>
+            <div class="add-button-task">Tareas</div>
+        </button>
+    </t>
+</template>

+ 9 - 0
static/src/xml/add_task_contractor.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template>
+    <t t-name="eiruCivilAddTask.Contractor">
+        <button class="button-add-task-contractor oe_stat_button btn btn_default">
+            <div class="stat_button_icon fa fa-tasks"></div>
+            <div class="add-button-task">Tareas</div>
+        </button>
+    </t>
+</template>

+ 9 - 0
static/src/xml/add_task_invoice_expenses.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template>
+    <t t-name="eiruAddInvoiceTask.Expenses">
+        <button class="button-add-task-invoice-expenses oe_stat_button btn btn_default">
+            <div class="stat_button_icon fa fa-tasks"></div>
+            <div class="add-button-task">Tareas</div>
+        </button>
+    </t>
+</template>

+ 110 - 0
static/src/xml/modal/modal_task.xml

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="eiruTasks.Modal">
+        <div class="modal in expired-account-modal" tabindex="-1" role="dialog"  data-backdrop="static">
+            <div class="modal-dialog modal-lg" role="document">
+                <div class="modal-content openerp">
+                    <div class="widget-content widget-loading-task-select">
+                        <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                    </div>
+                    <!-- title  -->
+                    <div class="modal-header select-task-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">×</button>
+                        <h3 class="modal-title">Selección de tareas</h3>
+                    </div>
+
+                    <!-- Body -->
+                    <div class="modal-body">
+                        <!-- Table -->
+                        <div class="oe_view_manager_body select-task-table">
+                            <div class="modal-head-wrapper-select-task">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <!-- Selection -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- code -->
+                                            <th class="oe_list_header_char oe_sortable">Código</th>
+                                            <!-- task_name -->
+                                            <th class="oe_list_header_char oe_sortable">Descripción</th>
+                                            <!-- uom_id -->
+                                            <th class="oe_list_header_char oe_sortable">UN</th>
+                                            <!-- qty -->
+                                            <th class="oe_list_header_char oe_sortable">Cant.</th>
+                                            <!-- amount -->
+                                            <th class="oe_list_header_char oe_sortable">Precio</th>
+                                            <!-- amount_total -->
+                                            <th class="oe_list_header_char oe_sortable">Total</th>
+                                            <!-- task_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- task_line_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- uom_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- type -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-select-task">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody">
+                                        <!-- <tr> -->
+                                        <tr t-foreach="tasks" t-as="task" >
+                                        <!-- <tr> -->
+                                            <td>
+                                                <!-- <t t-esc="task_value.selected"/> -->
+                                                <input type="checkbox" class="select-task-item" t-if="task_value.selected == true" checked='checked'></input>
+                                                <input type="checkbox" class="select-task-item" t-if="task_value.selected != true"></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.code"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskName"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.uomName"/>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-qty" t-attf-value="{{ task_value.qty }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.qty"/> -->
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-amount" t-attf-value="{{ task_value.amount }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.amount"/> -->
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-amoutn-total" t-attf-value="{{ task_value.amountTotal }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.amountTotal"/> -->
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskLineId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.uomId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.type"/>
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+                    <!-- Pie de Pagina -->
+                    <div class="modal-footer paymnets-invoice-footer">
+                        <button type="button" class="oe_button oe_form_button oe_highlight button-accept select-task-button">Guardar</button>
+                        <button type="button" class="oe_button oe_form_button oe_link dismmis-modal select-task-button" data-dismiss="modal">Salir</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+
+</template>

+ 120 - 0
static/src/xml/modal/modal_task_contractor.xml

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="eiruTasksOrder.Modal">
+        <div class="modal in expired-account-modal" tabindex="-1" role="dialog"  data-backdrop="static">
+            <div class="modal-dialog modal-lg" role="document">
+                <div class="modal-content openerp">
+                    <div class="widget-content widget-loading-task-select">
+                        <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                    </div>
+                    <!-- title  -->
+                    <div class="modal-header select-task-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">×</button>
+                        <h3 class="modal-title">Selección de tareas</h3>
+                    </div>
+
+                    <!-- Body -->
+                    <div class="modal-body">
+                        <!-- Table -->
+                        <div class="oe_view_manager_body select-task-table">
+                            <div class="modal-head-wrapper-select-task">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <!-- Selection -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- code -->
+                                            <th class="oe_list_header_char oe_sortable">Código</th>
+                                            <!-- task_name -->
+                                            <th class="oe_list_header_char oe_sortable">Descripción</th>
+                                            <!-- uom_id -->
+                                            <th class="oe_list_header_char oe_sortable">UN</th>
+                                            <!-- qty -->
+                                            <th class="oe_list_header_char oe_sortable">Cant.</th>
+                                            <!-- amount -->
+                                            <th class="oe_list_header_char oe_sortable">Precio</th>
+                                            <!-- amount_total -->
+                                            <th class="oe_list_header_char oe_sortable">Total</th>
+                                            <!-- task_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- task_line_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- uom_id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- type -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- Contractor  id -->
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <!-- Order lin ID -->
+                                            <!-- <th class="oe_list_header_char oe_sortable"></th> -->
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-select-task">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody">
+                                        <!-- <tr> -->
+                                        <tr t-foreach="tasks" t-as="task" >
+                                        <!-- <tr> -->
+                                            <td>
+                                                <!-- <t t-esc="task_value.selected"/> -->
+                                                <input type="checkbox" class="select-task-item" t-if="task_value.selected == true" checked='checked'></input>
+                                                <input type="checkbox" class="select-task-item" t-if="task_value.selected != true"></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.code"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskName"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.uomName"/>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-qty" t-attf-value="{{ task_value.qty }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.qty"/> -->
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-amount" t-attf-value="{{ task_value.amount }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.amount"/> -->
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input task-amoutn-total" t-attf-value="{{ task_value.amountTotal }}" disabled="disabled"></input>
+                                                <!-- <t t-esc="task_value.amountTotal"/> -->
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskLineId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.uomId"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.type"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.contractorId"/>
+                                            </td>
+                                            <!-- <td>
+                                                <t t-esc="task_value.orderLine"/>
+                                            </td> -->
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+                    <!-- Pie de Pagina -->
+                    <div class="modal-footer paymnets-invoice-footer">
+                        <button type="button" class="oe_button oe_form_button oe_highlight button-accept select-task-button">Guardar</button>
+                        <button type="button" class="oe_button oe_form_button oe_link dismmis-modal select-task-button" data-dismiss="modal">Salir</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+
+</template>

+ 77 - 0
static/src/xml/modal/modal_task_invoice_expenses.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="eiruInvoiceTaskExpenses.Modal">
+        <div class="modal in expired-account-modal" tabindex="-1" role="dialog"  data-backdrop="static">
+            <div class="modal-dialog modal-lg" role="document">
+                <div class="modal-content openerp">
+                    <div class="widget-content widget-loading-task-select">
+                        <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                    </div>
+
+                    <!-- title  -->
+                    <div class="modal-header select-task-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">×</button>
+                        <h3 class="modal-title">Selección de tareas</h3>
+                    </div>
+
+                    <!-- Body -->
+                    <div class="modal-body">
+                        <!-- Table -->
+                        <div class="oe_view_manager_body select-task-expenses-table">
+                            <div class="modal-head-wrapper-select-task-expenses">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <th class="oe_list_header_char oe_sortable">Código</th>
+                                            <th class="oe_list_header_char oe_sortable">Descripción</th>
+                                            <th class="oe_list_header_char oe_sortable">Total</th>
+                                            <th class="oe_list_header_char oe_sortable">Gastos</th>
+                                            <th class="oe_list_header_char oe_sortable">Residual</th>
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-select-task-expenses">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody">
+                                        <tr t-foreach="tasks" t-as="task" >
+                                            <td>
+                                                <input type="checkbox" class="select-task-expenses"></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.code"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.taskName"/>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input invoice-task-total" t-attf-value="{{ task_value.amountTotal }}" disabled="disabled"></input>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input invoice-task-expenses" t-attf-value="{{ task_value.amountExpenses }}" disabled="disabled"></input>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="task-input invoice-task-residual" t-attf-value="{{ task_value.residual }}" disabled="disabled"></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="task_value.moveLineId"/>
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+                    <!-- Pie de Pagina -->
+                    <div class="modal-footer paymnets-invoice-footer">
+                        <button type="button" class="oe_button oe_form_button oe_highlight button-accept select-task-button">Guardar</button>
+                        <button type="button" class="oe_button oe_form_button oe_link dismmis-modal select-task-button" data-dismiss="modal">Salir</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+
+</template>

+ 11 - 0
views/data.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <function model="construction.uom" name="create_default_uon"/>
+
+        <function model="construction.task" name="create_default_task"/>
+        <!-- Configuration default Data -->
+        <function model="construction.config" name="create_default_construction_config"/>
+
+    </data>
+</openerp>

+ 54 - 0
views/eiru_construction_account_invoice.xml

@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from eiru_construction_account_invoice-->
+        <record id="eiru_construction_account_invoice" model="ir.ui.view">
+            <field name="name">eiru_construction.account_invoice</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+                <!-- Orden -->
+                <field name="fiscal_position" position="after">
+                    <field name='construction_order_id' options="{'no_create': True}"  attrs="{'invisible': [('type', '!=', 'out_invoice')]}"/>
+                </field>
+            </field>
+        </record>
+        <!-- from expenses eiru_construction_account_invoice -->
+        <record id="eiru_construction_expenses_account_invoice" model="ir.ui.view">
+            <field name="name">eiru_construction_expenses.account_invoice</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_supplier_form"/>
+            <field name="arch" type="xml">
+                <notebook>
+                    <page string="Constructora">
+                        <group col="2">
+                            <group>
+                                <field name='construction_order_id' options="{'no_create': True}"/>
+                            </group>
+                            <group>
+                                <div class='eiru-task-expenses-add'  attrs="{'invisible': [('state', '=', 'draft')]}"></div>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Tareas y Actividad">
+                                <group col="1">
+                                     <!-- options="{'no_create': True} -->
+                                    <field name="expenses_ids" nolabel="1">
+                                        <tree create="false">
+                                            <field name="code" string="Codigo"/>
+                                            <field name="name" string="Tareas"/>
+                                            <field name="invoice_line_id" string="Producto"/>
+                                            <field name="quantity" string="Cantidad"/>
+                                            <field name="price_unit" string="Precio"/>
+                                            <field name="amount_total" string="Total"/>
+                                        </tree>
+                                    </field>
+                                </group>
+                            </page>
+                        </notebook>
+                    </page>
+                </notebook>
+            </field>
+        </record>
+    </data>
+</openerp>

+ 97 - 0
views/eiru_construction_config.xml

@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_config_from" model="ir.ui.view">
+            <field name="name">eiru_construction_config.from</field>
+            <field name="model">construction.config</field>
+            <field name="arch" type="xml">
+                <form string="Configuración de facturación de orden de servicios" create="0" delete="0">
+                    <sheet>
+                        <h1>
+                            <field name='name'/>
+                        </h1>
+                        <group>
+                            <field name='active' string='Activo'/>
+                        </group>
+                        <notebook>
+                            <page string="Configuraciones de facturas">
+                                <!-- Invoice -->
+                                <group col="2" string="Detalles de la factura">
+                                    <group>
+                                        <label for="invoice_journal_id" string="Diario" style="width: 200px"></label>
+                                        <field name="invoice_journal_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                        <label for="invoice_account_id" string="Contabilidad" style="width: 200px"></label>
+                                        <field name="invoice_account_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                    </group>
+                                    <group>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Diario:</b>
+                                            Diario que utilizara para la facturación del la orden de servicio, valor por defecto = <b style="color: #7C7BAD;">Const - Ventas</b>
+                                        </div>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Contabilidad:</b>
+                                            Cuenta de la empresa utilizada para la facturación del la orden de servicio, valor por defecto = <b style="color: #7C7BAD;">121000 - Créditos por Ventas / Deudores por Ventas</b>
+                                        </div>
+                                    </group>
+                                </group>
+                                <!-- Line -->
+                                <group string="Detalle de los ítem de la factura" col="2">
+                                    <group>
+                                        <label for="line_account_id" string="Contabilidad" style="width: 200px"></label>
+                                        <field name="line_account_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                        <label for="line_tax_id" string="Impuestos" style="width: 200px"></label>
+                                        <field name="line_tax_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                    </group>
+                                    <group>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Contabilidad</b>
+                                            Cuenta de ingresos o gastos  relacionado con la linea de la factura, valor por defecto = <b style="color: #7C7BAD;">411.01  - Ventas - Categoria de productos 01</b>
+                                        </div>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Impuestos</b>
+                                            Impuestos aplicado sobre las lineas de la factura  = <b style="color: #7C7BAD;">IVA 10% Venta,<br/> IVA 5% Venta </b>
+                                        </div>
+                                    </group>
+                                </group>
+                            </page>
+                        </notebook>
+                        <group>
+                            <field name='comment' string="Información adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_config_tree" model="ir.ui.view">
+			<field name="name">eiru_construction_config.tree</field>
+			<field name="model">construction.config</field>
+			<field name="arch" type="xml">
+				<tree create="false" delete="false">
+					<field name="name" />
+					<field name="invoice_journal_id" string="Diario"/>
+					<field name="invoice_account_id" string="Contabilidad"/>
+					<field name="line_account_id" string="Contabilidad"/>
+					<field name="line_tax_id" string="Impuestos"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_config_actions" model="ir.actions.act_window">
+            <field name="name">Configuración de facturación de orden de servicios</field>
+            <field name="res_model">construction.config</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+
+        <!-- Menu -->
+        <menuitem
+            id="menu_eiru_construction_config"
+            name="Configuración Facturación"
+            parent="eiru_construction_menu_confg"
+            action="eiru_construction_config_actions"
+            sequence="1"/>
+    </data>
+</openerp>

+ 36 - 0
views/eiru_construction_expenses_move_line.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <!-- from -->
+        <record id="eiru_construction_expenses_move_line_form" model="ir.ui.view">
+            <field name="name">eiru_construction_expenses_move_line.form</field>
+            <field name="model">construction.expenses.move.line</field>
+            <field name="arch" type="xml">
+                <form create='0'>
+                    <sheet>
+                        <h2>
+                            <field name="code" class="oe_inline" readonly="1" style="width:6em"/> -
+                            <field name="name" class="oe_inline" readonly="1"/>
+                        </h2>
+                        <group col="2">
+                            <group>
+                                <field name="move_line_id" string="Actividad" readonly="1"/>
+                                <field name="invoice_id" string="Factura" readonly="1"/>
+                                <field name="invoice_line_id" string="Producto"  domain="[('invoice_id', '=', invoice_id)]"/>
+                            </group>
+                            <group>
+                                <field name="quantity" string="Cantidad"/>
+                                <field name="price_unit" string="Prtecio"/>
+                                <field name="amount_total" string="Total" readonly="1"/>
+                            </group>
+                        </group>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+    </data>
+</openerp>

+ 10 - 0
views/eiru_construction_menu.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <menuitem id="eiru_construction_menu" name="Constructora" sequence="20"/>
+        <menuitem id="eiru_construction_menu_work" name="Obras" parent="eiru_construction_menu" sequence="1"/>
+        <menuitem id="eiru_construction_menu_move" name="Estado Financiero" parent="eiru_construction_menu" sequence="2"/>
+        <menuitem id="eiru_construction_menu_task" name="Tareas y Actividades" parent="eiru_construction_menu" sequence="3"/>
+        <menuitem id="eiru_construction_menu_confg" name="Configuración" parent="eiru_construction_menu" sequence="10"/>
+    </data>
+</openerp>

+ 163 - 0
views/eiru_construction_move.xml

@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_move_form" model="ir.ui.view">
+            <field name="name">eiru_construction_move.form</field>
+            <field name="model">construction.move</field>
+            <field name="arch" type="xml">
+                <form>
+                    <header>
+                        <field name="state" widget="statusbar"/>
+                    </header>
+                    <sheet>
+                        <h1>
+                            <field name="name" class="oe_inline" readonly="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name="partner_id" string="Socio" readonly="1"/>
+                                <field name="order_id" string="Orden de servicio" readonly="1"/>
+                                <field name="currency_id" string="Moneda" readonly="1"/>
+                            </group>
+                            <group>
+                                <field name="date" string="Fecha"/>
+                                <field name="work_id" string="Obra" readonly="1"/>
+                                <!-- <field name="type" string="Tipo"/> -->
+                                <field name="invoice_id" string="Factura" readonly="1"/>
+                            </group>
+                        </group>
+                        <group col="2" string='Estado Financiero'>
+                            <group string="Finanzas">
+                                <field name="amount_total" string="Importe Total" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                                <field name="amount_paid" string="Importe Pagado" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                                <field name="residual" string="Residual" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                            </group>
+                            <group string="Gastos">
+                                <field name="amount_expenses" string="Total Gastos" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                                <field name="available_expenses" string="Gastos Disponible" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                            </group>
+                        </group>
+
+                        <notebook>
+                            <page string="Tareas">
+                                <field name="move_lines_ids" >
+                                    <tree  colors="red:type=='task';gray:type=='activity'" edit="false" create="false" delete="false" string="Lista de tareas y actividades">
+                                        <field name="code" string="Codigo"/>
+                                        <field name="task_name" string="Descripciónes"/>
+                                        <field name="amount_total" string="Total"/>
+                                        <field name="amount_expenses" string="Gastos"/>
+                                        <field name="residual" string="Residual"/>
+                                        <field name="type" invisible="1"/>
+                                        <field name="uom_id" string="UN" invisible="1"/>
+                                        <field name="task_id" invisible="1"/>
+                                    </tree>
+                                </field>
+                            </page>
+                        </notebook>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_move_tree" model="ir.ui.view">
+			<field name="name">eiru_construction_move.tree</field>
+			<field name="model">construction.move</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name="name" string="Descripción"/>
+                    <field name="order_id" string="Orden de servicio"/>
+                    <field name="work_id" string="Obra" />
+                    <field name="amount_total" string="Importe Total" />
+                    <field name="amount_paid" string="Importe Pagado"/>
+                    <field name="residual" string="Residual"/>
+                    <field name="type" string="Tipo"/>
+				</tree>
+			</field>
+		</record>
+
+        <!-- from -->
+        <record id="eiru_construction_move_line_form" model="ir.ui.view">
+            <field name="name">eiru_construction_move_line.form</field>
+            <field name="model">construction.move.line</field>
+            <field name="arch" type="xml">
+                <form create='0' edit='0' string='Detalles de las actividades'>
+                    <sheet>
+                        <h1>
+                            <field name="code" class="oe_inline" readonly="1" style="width:6em"/> -
+                            <field name="task_name" class="oe_inline" readonly="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name="task_id" string="Tarea" readonly="1"/>
+                                <field name="uom_id" string="Unidad de medida" readonly="1"/>
+                            </group>
+                            <group>
+                                <field name="task_line_id" string="Actividad" readonly="1"/>
+                                <field name="move_id" string="Origin" readonly="1"/>
+                            </group>
+                        </group>
+
+                        <group string="Finanzas">
+                            <field name="amount_total" string="Importe Total" widget='monetary' readonly="1"/>
+                            <field name="amount_expenses" string="Gastos" widget='monetary' readonly="1"/>
+                            <field name="residual" string="Residual" widget='monetary' readonly="1"/>
+                        </group>
+                        <notebook>
+                            <page string="Gastos">
+                                <field name="expenses_ids" >
+                                    <tree edit="false" create="false" delete="false" string="Lista de Materiales">
+                                        <field name="invoice_line_id" string="Producto"/>
+                                        <field name="quantity" string="Cantidad"/>
+                                        <field name="price_unit" string="Prtecio Unitario"/>
+                                        <field name="amount_total" string="Total"/>
+                                        <field name="invoice_id" string="Factura"/>
+                                    </tree>
+                                </field>
+                            </page>
+                        </notebook>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+
+
+        <!-- Actions  -->
+        <record id="eiru_construction_move_actions" model="ir.actions.act_window">
+            <field name="name">Clientes</field>
+            <field name="res_model">construction.move</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+            <field name="context">{'type':'order'}</field>
+            <field name="domain">[('type', '=', 'order')]</field>
+        </record>
+
+        <record id="eiru_construction_move_actions_contractor" model="ir.actions.act_window">
+            <field name="name">Contratista</field>
+            <field name="res_model">construction.move</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+            <field name="context">{'type':'contractor'}</field>
+            <field name="domain">[('type', '=', 'contractor')]</field>
+        </record>
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_move"
+            name="Clientes"
+            parent="eiru_construction_menu_move"
+            action="eiru_construction_move_actions"
+            sequence="1"/>
+
+        <menuitem
+            id="menu_eiru_construction_move_contractor"
+            name="Contratista"
+            parent="eiru_construction_menu_move"
+            action="eiru_construction_move_actions_contractor"
+            sequence="2"/>
+    </data>
+</openerp>

+ 121 - 0
views/eiru_construction_order.xml

@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_order_form" model="ir.ui.view">
+            <field name="name">eiru_construction_order.form</field>
+            <field name="model">construction.order</field>
+            <field name="arch" type="xml">
+                <form>
+                    <header>
+                        <button name='action_confirm_budget' string="Confirm Budget" type='object' class='oe_highight' attrs="{'invisible': ['|',('type', '!=', 'budget'),('state','!=','draft')]}"/>
+                        <button name='action_confirm_order' string="Confirm Order" type='object' class='oe_highight' attrs="{'invisible': ['|',('type', '!=', 'order'),('state','!=','draft')]}"/>
+                        <field name="state" widget="statusbar"/>
+                    </header>
+                    <sheet>
+                        <h1>
+                            <field name="name" class="oe_inline" readonly="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name="work_id" string="Obra"/>
+                                <field name="order_street" string="Dirección"/>
+                                <field name="total_area" string="Superficie de obra"/>
+                                <field name="currency_id" string="Moneda"/>
+                            </group>
+                            <group>
+                                <field name="date" string="Fecha"/>
+                                <field name="partner_id" string="Propietario"/>
+                                <field name="order_city" string="Ciudad"/>
+                                <field name='type' invisible='1'/>
+                                <field name="budget_id" readonly='1' attrs="{'invisible': [('type', '!=', 'order')]}"/>
+                                <field name="order_id" readonly='1' attrs="{'invisible': [('type', '!=', 'budget')]}"/>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Detalles">
+                                <div class="eiru-add-task" attrs="{'invisible': [('state', '!=', 'draft')]}"></div>
+                                <field name="line_ids" >
+                                    <tree class="eiru-table-order"  default_order="id, desc" colors="red:type=='task';gray:type=='activity'" edit="false" create="false" delete="false" string="Lista de tareas y actividades">
+                                        <field name="task_id" invisible="1"/>
+                                        <field name="code" string="Codigo"/>
+                                        <field name="task_name" string="Descripciónes"/>
+                                        <field name="uom_id" string="UN"/>
+                                        <field name="qty" string="Cantidad" />
+                                        <field name="amount" string="Precio" />
+                                        <field name="amount_total" string="Total"/>
+                                        <field name="type" invisible="1"/>
+                                    </tree>
+                                </field>
+                            </page>
+                            <page string="Sub-Contratista">
+                                <field name='contractor_budget_ids' attrs="{'invisible': [('type', '!=', 'budget')]}"></field>
+                                <field name='contractor_order_ids' attrs="{'invisible': [('type', '!=', 'order')]}"></field>
+                            </page>
+                        </notebook>
+                        <group class="oe_subtotal_footer oe_right">
+                            <field name='amount_total' string="Total" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                        </group>
+
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+
+        <!-- Tree -->
+        <record id="eiru_construction_order_tree" model="ir.ui.view">
+			<field name="name">eiru_construction_order.tree</field>
+			<field name="model">construction.order</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name="name" string="Descripción"/>
+                    <field name="date" string="Fecha"/>
+                    <field name="work_id" string="Obra"/>
+                    <field name="partner_id" string="Propietario"/>
+                    <field name="total_area" string="Superficie de obra"/>
+                    <field name="state" string="Estado"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_order_actions" model="ir.actions.act_window">
+            <field name="name">Orden</field>
+            <field name="res_model">construction.order</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+            <field name="context">{'type':'order'}</field>
+            <field name="domain">[('type', '=', 'order')]</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_order"
+            name="Orden de servicio"
+            parent="eiru_construction_menu_work"
+            action="eiru_construction_order_actions"
+            sequence="2"/>
+
+        <!-- Actions  -->
+        <record id="eiru_construction_budget_actions" model="ir.actions.act_window">
+            <field name="name">Presupuesto</field>
+            <field name="res_model">construction.order</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+            <field name="context">{'type':'budget'}</field>
+            <field name="domain">[('type', '=', 'budget')]</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_budget"
+            name="Presupuesto"
+            parent="eiru_construction_menu_work"
+            action="eiru_construction_budget_actions"
+            sequence="1"/>
+    </data>
+</openerp>

+ 83 - 0
views/eiru_construction_order_contractor.xml

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_order_contractor_form" model="ir.ui.view">
+            <field name="name">eiru_construction_order_contractor.form</field>
+            <field name="model">construction.order.contractor</field>
+            <field name="arch" type="xml">
+                <form>
+                    <header>
+                        <field name="state" widget="statusbar"/>
+                    </header>
+                    <sheet>
+                        <h1>
+                            <field name="name" class="oe_inline" readonly="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name="partner_id" string="Contratista" domain="[('contractor', '=', True)]"/>
+                                <field name="budget_id" string="Presupuesto" domain="[('type', '=', 'budget')]"/>
+                            </group>
+                            <group>
+                                <field name="date" string="Fecha"/>
+                                <field name="order_id" string="Orden de servicio" domain="[('type', '=', order)]" readonly="1"/>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Tareas">
+                                <div class="eiru-add-task-contractor" attr="{'invisible': [('state', '!=', 'draft')]}"></div>
+                                <field name="line_ids" >
+                                    <tree class="eiru-table-order"  default_order="id, desc" colors="red:type=='task';gray:type=='activity'" edit="false" create="false" delete="false" string="Lista de tareas y actividades">
+                                        <field name="task_id" invisible="1"/>
+                                        <field name="code" string="Codigo"/>
+                                        <field name="task_name" string="Descripciónes"/>
+                                        <field name="uom_id" string="UN"/>
+                                        <field name="qty" string="Cantidad" />
+                                        <field name="amount" string="Precio" />
+                                        <field name="amount_total" string="Total"/>
+                                        <field name="type" invisible="1"/>
+                                    </tree>
+                                </field>
+                            </page>
+                        </notebook>
+                        <group class="oe_subtotal_footer oe_right">
+                            <field name='amount_total' string="Total" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field':'currency_id'}" readonly="1"/>
+                        </group>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_order_contractor_tree" model="ir.ui.view">
+			<field name="name">eiru_construction_order_contractor.tree</field>
+			<field name="model">construction.order.contractor</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name="name" string="Descripción"/>
+                    <field name="partner_id" string="Contratista"/>
+                    <field name="budget_id" string="Presupuesto"/>
+                    <field name="order_id" string="Orden"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_order_contractor_actions" model="ir.actions.act_window">
+            <field name="name">Subcontratista</field>
+            <field name="res_model">construction.order.contractor</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_order_contractor"
+            name="Subcontratista"
+            parent="eiru_construction_menu_work"
+            action="eiru_construction_order_contractor_actions"
+            sequence="15"/>
+    </data>
+</openerp>

+ 34 - 0
views/eiru_construction_order_sequence.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+        <!-- BUDGET -->
+        <!-- Sequence type -->
+        <record id="seq_type_construction_order_budget" model="ir.sequence.type">
+            <field name="name">Construction Order Budget</field>
+            <field name="code">construction.order.budget</field>
+        </record>
+        <!-- Sequence -->
+        <record id="seq_construction_order_budget" model="ir.sequence">
+            <field name="name">Construction Order Budget</field>
+            <field name="code">construction.order.budget</field>
+            <field name="prefix">CONST/PRESU/</field>
+            <field name="padding">5</field>
+            <field name="company_id" eval="False"/>
+        </record>
+
+        <!-- ORDER -->
+        <!-- Sequence type -->
+        <record id="seq_type_construction_order_order" model="ir.sequence.type">
+            <field name="name">Construction Order Order</field>
+            <field name="code">construction.order.order</field>
+        </record>
+        <!-- Sequence -->
+        <record id="seq_construction_order_order" model="ir.sequence">
+            <field name="name">Construction Order order</field>
+            <field name="code">construction.order.order</field>
+            <field name="prefix">CONST/ORDER/</field>
+            <field name="padding">5</field>
+            <field name="company_id" eval="False"/>
+        </record>
+    </data>
+</openerp>

+ 58 - 0
views/eiru_construction_oum.xml

@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_oum_form" model="ir.ui.view">
+            <field name="name">eiru.construction.oum.form</field>
+            <field name="model">construction.uom</field>
+            <field name="arch" type="xml">
+                <form string="Unida de Medida">
+                    <sheet>
+                        <group col="2">
+                            <group>
+                                <field name='name' string="Unidad de medida"/>
+                                <field name="decimal_places" string="Cantidad de Decimales"/>
+                            </group>
+                            <group>
+                                <field name="ref" string="Referencia"/>
+                                <field name="active" string="Activo"/>
+                            </group>
+                        </group>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_oum_tree" model="ir.ui.view">
+			<field name="name">eiru.construction.oum.tree</field>
+			<field name="model">construction.uom</field>
+			<field name="arch" type="xml">
+				<tree>
+					<field name="name" string="Unidad de medida"/>
+					<field name="ref" />
+					<field name="decimal_places" />
+		            <field name="active" />
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_oum_actions" model="ir.actions.act_window">
+            <field name="name">Unida de Medida</field>
+            <field name="res_model">construction.uom</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_oum"
+            name="Unida de Medida"
+            parent="eiru_construction_menu_confg"
+            action="eiru_construction_oum_actions"
+            sequence="5"/>
+    </data>
+</openerp>

+ 72 - 0
views/eiru_construction_task.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_task_form" model="ir.ui.view">
+            <field name="name">eiru.construction.task.form</field>
+            <field name="model">construction.task</field>
+            <field name="arch" type="xml">
+                <form string="Tarea">
+                    <sheet>
+                        <h1>
+                            <field name="name" nolabel="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name='code' string="Codigo"/>
+                                <field name="active" string="Activo"/>
+                            </group>
+                            <group>
+                                <field name="ref" string="Referencia"/>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Actividades ">
+                                <field name="line_ids">
+                                    <tree string="Lista de actividades">
+                                        <field name="code" string="Codigo"/>
+                                        <field name="name" string="Descripción"/>
+                                        <field name="construction_uom" string="Unida de Medida"/>
+                                        <field name="amount" string="Precio Unitario"/>
+                                    </tree>
+                                </field>
+                            </page>
+                        </notebook>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_task_tree" model="ir.ui.view">
+			<field name="name">eiru.construction.task.tree</field>
+			<field name="model">construction.task</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name='code' string="Codigo"/>
+                    <field name="name" string="Descripción"/>
+                    <field name="ref" string="Referencia"/>
+                    <field name="active" string="Activo"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_task_actions" model="ir.actions.act_window">
+            <field name="name">Tarea</field>
+            <field name="res_model">construction.task</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_task"
+            name="Tarea"
+            parent="eiru_construction_menu_task"
+            action="eiru_construction_task_actions"
+            sequence="1"/>
+    </data>
+</openerp>

+ 65 - 0
views/eiru_construction_task_line.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_task_line_form" model="ir.ui.view">
+            <field name="name">eiru.construction.task.line.form</field>
+            <field name="model">construction.task.line</field>
+            <field name="arch" type="xml">
+                <form string="Actividad">
+                    <sheet>
+                        <h1>
+                            <field name="name" nolabel="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name='code' string="Codigo"/>
+                                <field name='construction_task' string="Tarea"/>
+                                <field name='amount' string="Precio Unitario"/>
+                            </group>
+                            <group>
+                                <field name="ref" string="Referencia"/>
+                                <field name="construction_uom" string="Unidad de Medida"/>
+                                <field name="active" string="Activo"/>
+                            </group>
+                        </group>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_task_line_tree" model="ir.ui.view">
+			<field name="name">eiru.construction.task.line.tree</field>
+			<field name="model">construction.task.line</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name='code' string="Codigo"/>
+                    <field name="name" string="Descripción"/>
+                    <field name="ref" string="Referencia"/>
+                    <field name="construction_task" string="Tarea"/>
+                    <field name="construction_uom" string="Unidad de Medida"/>
+                    <field name="amount" string="Precio Unitario"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_task_line_actions" model="ir.actions.act_window">
+            <field name="name">Actividad</field>
+            <field name="res_model">construction.task.line</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_task_line"
+            name="Actividad"
+            parent="eiru_construction_menu_task"
+            action="eiru_construction_task_line_actions"
+            sequence="2"/>
+    </data>
+</openerp>

+ 62 - 0
views/eiru_construction_work.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_construction_work_form" model="ir.ui.view">
+            <field name="name">eiru.construction.work.form</field>
+            <field name="model">construction.work</field>
+            <field name="arch" type="xml">
+                <form string="works">
+                    <sheet>
+                        <h1>
+                            <field name="name" nolabel="1"/>
+                        </h1>
+                        <group col="2">
+                            <group>
+                                <field name='partner_id' string="Propietario" domain="[('customer', '=', True)]" required="1"/>
+                                <field name="work_street" string="Dirección" required="1"/>
+                            </group>
+                            <group>
+                                <field name="work_city" string="Ciudad" required="1"/>
+                                <field name="active" string="Activo"/>
+                            </group>
+                        </group>
+                        <group>
+                            <field name="comment" string="Información Adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_construction_work_tree" model="ir.ui.view">
+			<field name="name">eiru.construction.work.tree</field>
+			<field name="model">construction.work</field>
+			<field name="arch" type="xml">
+				<tree>
+                    <field name="name" string='Obra'/>
+                    <field name='partner_id' string="Propietario"/>
+                    <field name="work_street" string="Dirección"/>
+                    <field name="work_city" string="Ciudad"/>
+                    <field name="active" string="Activo"/>
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_construction_work_actions" model="ir.actions.act_window">
+            <field name="name">Obra</field>
+            <field name="res_model">construction.work</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+
+        <!-- Menu  -->
+        <menuitem
+            id="menu_eiru_construction_work"
+            name="Obras"
+            parent="eiru_construction_menu_work"
+            action="eiru_construction_work_actions"
+            sequence="5"/>
+    </data>
+</openerp>

+ 81 - 0
views/eiru_res_partner_contractor.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_res_partner_contructor" model="ir.ui.view">
+            <field name="name">eiru_res_partner.contructor</field>
+            <field name="model">res.partner</field>
+            <field name="inherit_id" ref="base.view_partner_form"/>
+            <field name="arch" type="xml">
+
+                <field name="active" position="before">
+                    <field name='contractor' string="Contratista / Subcontratista" help='Marque esta casilla para indicar si es un Contratista o Subcontratista.'/>
+                </field>
+
+                <notebook>
+                    <page string="Constructora">
+                        <notebook>
+                            <page string="Obras">
+                                <group col="1">
+                                    <field name="works" readonly="1" nolabel="1" delete='false' create="false" editable="false">
+                                        <tree>
+                                            <field name="name" string='Obra'/>
+                                            <field name="work_street" string="Dirección"/>
+                                            <field name="work_city" string="Ciudad"/>
+                                        </tree>
+                                    </field>
+                                </group>
+                            </page>
+
+                            <page string="Presupuestos">
+                                <group col="1">
+                                    <field name="construction_budget" readonly="1" nolabel="1" delete='false' create="false" editable="false">
+                                        <tree>
+                                            <field name="name" string="Descripción"/>
+                                            <field name="date" string="Fecha"/>
+                                            <field name="work_id" string="Obra"/>
+                                            <field name="partner_id" string="Propietario"/>
+                                            <field name="total_area" string="Superficie de obra" widget="hamdle"/>
+                                            <field name="state" string="Estado"/>
+                                        </tree>
+                                    </field>
+                                </group>
+                            </page>
+
+
+                            <page string="Orden de Servicios">
+                                <group col="1">
+                                    <field name="construction_order" readonly="1" nolabel="1" delete='false' create="false" editable="false">
+                                        <tree>
+                                            <field name="name" string="Descripción"/>
+                                            <field name="date" string="Fecha"/>
+                                            <field name="work_id" string="Obra"/>
+                                            <field name="partner_id" string="Propietario"/>
+                                            <field name="total_area" string="Superficie de obra"/>
+                                            <field name="state" string="Estado"/>
+                                        </tree>
+                                    </field>
+                                </group>
+                            </page>
+                            <page string="Estado Financiero">
+                                <group col="1">
+                                    <field name="construction_move_id" readonly="1" nolabel="1" delete='false' create="false" editable="false">
+                                        <tree>
+                                            <field name="name" string="Descripción"/>
+                                            <field name="order_id" string="Orden de servicio"/>
+                                            <field name="work_id" string="Obra" />
+                                            <field name="amount_total" string="Importe Total" />
+                                            <field name="amount_paid" string="Importe Pagado"/>
+                                            <field name="residual" string="Residual"/>
+                                            <field name="type" string="Tipo"/>
+                                        </tree>
+                                    </field>
+                                </group>
+                            </page>
+                        </notebook>
+                    </page>
+                </notebook>
+            </field>
+        </record>
+    </data>
+</openerp>

+ 12 - 0
views/templates.xml

@@ -0,0 +1,12 @@
+<openerp>
+    <data>
+        <template id="eiru_civil_engineering.eiru_assets" name="eiru_civil_engineering_eiru_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/eiru_civil_engineering/static/src/css/style.css"/>
+                <script type="text/javascript" src="/eiru_civil_engineering/static/src/js/eiru_civil_engineering.js"/>
+                <script type="text/javascript" src="/eiru_civil_engineering/static/src/js/eiru_civil_engineering_contractor.js"/>
+                <script type="text/javascript" src="/eiru_civil_engineering/static/src/js/eiru_civil_invoice_task_expenses.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>