Browse Source

Changes suggested by @pedrobaeza

pull/26/head
Carlos Incaser 9 years ago
parent
commit
0233b31aa0
  1. 16
      contract/README.rst
  2. 29
      contract/i18n/es.po
  3. 3
      contract/models/contract.py
  4. 15
      contract/models/invoice.py
  5. 18
      contract/views/contract.xml

16
contract/README.rst

@ -6,8 +6,13 @@
Contracts for recurrent invoicing
=================================
* This module forward-port to v9 the contracts management with recurring
invoicing functions.
This module forward-port to v9 the contracts management with recurring
invoicing functions.
Configuration
=============
To view discount field set *Discount on lines* in user access rights.
Usage
=====
@ -17,12 +22,11 @@ To use this module, you need to:
#. Go to Sales -> Contracts and select or create a new contract.
#. Check *Generate recurring invoices automatically*.
#. Fill fields and add new lines. You have the possibility to use markers in
in description field to show init date and end of invoiced period.
#. To view discount field set *Discount on lines* in user access rights.
the description field to show the start and end date of the invoiced period.
#. A cron is created with daily interval, but if you are in debug mode can
click on *Create invoices* to force this action.
#. Click *Show invoices* link to show all invoices created by the contract.
#. Press *Invoices* button to show all invoices related with the contract.
#. Click *Show recurring invoices* link to show all invoices created by the
contract.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot

29
contract/i18n/es.po

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo 9.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-25 23:49+0000\n"
"PO-Revision-Date: 2016-03-26 00:49+0100\n"
"POT-Creation-Date: 2016-03-28 19:26+0000\n"
"PO-Revision-Date: 2016-03-28 21:28+0100\n"
"Last-Translator: Carlos Incaser <carlos@incaser.es>\n"
"Language-Team: \n"
"Language: es_ES\n"
@ -49,7 +49,6 @@ msgstr "Contrato"
#. module: contract
#: model:ir.actions.act_window,name:contract.action_account_analytic_overdue_all
#: model:ir.model.fields,field_description:contract.field_account_invoice_analytic_account_ids
#: model:ir.ui.menu,name:contract.menu_action_account_analytic_overdue_all
msgid "Contracts"
msgstr "Contratos"
@ -72,7 +71,7 @@ msgstr "Creado en"
#. module: contract
#: model:ir.model.fields,field_description:contract.field_account_analytic_account_recurring_next_date
msgid "Date of Next Invoice"
msgstr "Próximo fecha de factura"
msgstr "Próxima fecha de factura"
#. module: contract
#: model:ir.model.fields,field_description:contract.field_account_analytic_account_date_start
@ -95,7 +94,7 @@ msgid "Discount (%)"
msgstr "Descuento (%)"
#. module: contract
#: code:addons/contract/models/contract.py:56
#: code:addons/contract/models/contract.py:59
#, python-format
msgid "Discount should be less or equal to 100"
msgstr "El descuento debería ser menor o igual a 100"
@ -140,17 +139,10 @@ msgid "Invoice Lines"
msgstr "Líneas de factura"
#. module: contract
#: model:ir.actions.act_window,name:contract.act_analytic_invoices
#: model:ir.actions.act_window,name:contract.act_recurring_invoices
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
msgid "Invoices"
msgstr "Facturas"
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
msgid "Invoices related with this contract"
msgstr "Facturas relacionadas con este contrato"
#. module: contract
#: model:ir.model.fields,field_description:contract.field_account_analytic_account_journal_id
msgid "Journal"
@ -188,7 +180,7 @@ msgid "Next Invoice"
msgstr "Próxima factura"
#. module: contract
#: code:addons/contract/models/contract.py:194
#: code:addons/contract/models/contract.py:197
#, python-format
msgid "Please define a sale journal for the company '%s'."
msgstr "Por favor define un diario de ventas para la compañía '%s'."
@ -260,7 +252,7 @@ msgid "Year(s)"
msgstr "Año(s)"
#. module: contract
#: code:addons/contract/models/contract.py:186
#: code:addons/contract/models/contract.py:189
#, python-format
msgid "You must first select a Customer for Contract %s!"
msgstr "¡Seleccione un cliente para este contrato %s!"
@ -272,12 +264,11 @@ msgstr "account.analytic.invoice.line"
#. module: contract
#: model:ir.ui.view,arch_db:contract.account_analytic_account_recurring_form_form
msgid "⇒ Show invoices"
msgstr "⇒ Mostrar facturas"
msgid "⇒ Show recurring invoices"
msgstr "⇒ Mostrar facturas recurrentes"
#, fuzzy
#~ msgid "Recurring Invoice"
#~ msgstr "Recurring Invoice"
#~ msgid "Invoices related with this contract"
#~ msgstr "Facturas relacionadas con este contrato"
#~ msgid ""
#~ "Use contracts to follow tasks, issues, timesheets or invoicing based on\n"

3
contract/models/contract.py

@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
# © 2016 Incaser Informatica S.L. - Carlos Dauden
# © 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2014 Domatix Technologies S.L. - Angel Moya <angel.moya@domatix.com>
# © 2004-2010 OpenERP SA (<http://openerp.com>)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from dateutil.relativedelta import relativedelta

15
contract/models/invoice.py

@ -2,7 +2,7 @@
# © 2016 Incaser Informatica S.L. - Carlos Dauden
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import api, fields, models
from openerp import fields, models
class AccountInvoice(models.Model):
@ -11,16 +11,3 @@ class AccountInvoice(models.Model):
contract_id = fields.Many2one(
'account.analytic.account',
string='Contract')
analytic_account_ids = fields.Many2many(
comodel_name='account.analytic.account',
compute='_compute_analytic_account_ids',
store=True,
string='Contracts')
@api.multi
@api.depends('invoice_line_ids.account_analytic_id')
def _compute_analytic_account_ids(self):
for invoice in self:
invoice.analytic_account_ids = invoice.mapped(
'invoice_line_ids.account_analytic_id'
)

18
contract/views/contract.xml

@ -13,28 +13,12 @@
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record>
<record id="act_analytic_invoices" model="ir.actions.act_window">
<field name="context">{'search_default_analytic_account_ids':
[active_id], 'default_analytic_account_ids': active_id}</field>
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="domain">[('analytic_account_ids','=',active_id)]</field>
<field name="view_id" ref="account.invoice_tree" />
<field name="search_view_id" ref="account.view_account_invoice_filter" />
</record>
<record id="account_analytic_account_recurring_form_form" model="ir.ui.view">
<field name="name">account.analytic.account.invoice.recurring.form.inherit</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="40" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//div[@name="button_box"]' position='inside'>
<button class="oe_stat_button" type="action" icon="fa-edit"
name="%(contract.act_analytic_invoices)d"
string="Invoices" help="Invoices related with this contract">
</button>
</xpath>
<notebook position="before">
<separator string="Recurring Invoices" attrs="{'invisible': [('recurring_invoices','!=',True)]}"/>
<div>
@ -46,7 +30,7 @@
groups="base.group_no_one"/>
<button name="%(contract.act_recurring_invoices)d" type="action"
attrs="{'invisible': [('recurring_invoices','!=',True)]}"
string="⇒ Show invoices" class="oe_link"/>
string="⇒ Show recurring invoices" class="oe_link"/>
</div>
<group attrs="{'invisible': [('recurring_invoices','!=',True)]}">
<field name="journal_id"/>

Loading…
Cancel
Save