Compare commits
98 Commits
8.0-purcha
...
9.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da53473b60 | ||
|
|
667775d466 | ||
|
|
25de048402 | ||
|
|
817fadd167 | ||
|
|
25ea1991cf | ||
|
|
c8c1f78e66 | ||
|
|
0bc6cb32d9 | ||
|
|
db736d95a3 | ||
|
|
f83c948889 | ||
|
|
d736663f3f | ||
|
|
f051537a92 | ||
|
|
193e5e6ecc | ||
|
|
00592100f7 | ||
|
|
0d524f27d8 | ||
|
|
4509b2631a | ||
|
|
2ff7943c62 | ||
|
|
d85e7270b3 | ||
|
|
7b6916ce16 | ||
|
|
a9c6f9ed69 | ||
|
|
7a11966992 | ||
|
|
d4fcaa7d14 | ||
|
|
77fb97f273 | ||
|
|
9670eb7c10 | ||
|
|
f8e955d5b7 | ||
|
|
a803d1dcb9 | ||
|
|
a141f0506b | ||
|
|
7c554aee33 | ||
|
|
07c81e441d | ||
|
|
4c3c8e50db | ||
|
|
60beb99580 | ||
|
|
709bde8fb7 | ||
|
|
281c0b7052 | ||
|
|
8d55f9aaa5 | ||
|
|
964b1fca67 | ||
|
|
e20f88baf0 | ||
|
|
15d9c31f6f | ||
|
|
e74864e54f | ||
|
|
146c0e6b7d | ||
|
|
869c7176f7 | ||
|
|
4b26ab78be | ||
|
|
662494db35 | ||
|
|
aafc36dfdb | ||
|
|
e94168ad27 | ||
|
|
9b62198115 | ||
|
|
309027198a | ||
|
|
c8f1517881 | ||
|
|
6cb195a3eb | ||
|
|
b85f5184c2 | ||
|
|
2d392ce465 | ||
|
|
e71ad5f952 | ||
|
|
3905a826fa | ||
|
|
18ea374d8c | ||
|
|
f8d3340e48 | ||
|
|
9761c7527b | ||
|
|
baf7359cc7 | ||
|
|
33561ed930 | ||
|
|
aad2121f20 | ||
|
|
880cf7c7a9 | ||
|
|
d3eef1e5a5 | ||
|
|
b41f188eb4 | ||
|
|
891c64bb1f | ||
|
|
b9e07ea986 | ||
|
|
12fbd5dc2c | ||
|
|
7948193fe0 | ||
|
|
64cb3d44ad | ||
|
|
08f434b6a0 | ||
|
|
6176b37fa6 | ||
|
|
4015f5b1c9 | ||
|
|
ef920f58f4 | ||
|
|
c108f617c2 | ||
|
|
4acce9509f | ||
|
|
e9ab3187e7 | ||
|
|
13e6facec5 | ||
|
|
6c53b3c1ae | ||
|
|
a379b59597 | ||
|
|
2f179995bf | ||
|
|
7c5f04a39e | ||
|
|
b814ec11bf | ||
|
|
7d39e50ba3 | ||
|
|
77995aa125 | ||
|
|
314350efee | ||
|
|
40ef119999 | ||
|
|
6583ea0cd9 | ||
|
|
7def6a85e4 | ||
|
|
618ad6d6d6 | ||
|
|
05c0f74420 | ||
|
|
78ff16436d | ||
|
|
b4dc9da272 | ||
|
|
3aa16cdacf | ||
|
|
d823e3ae75 | ||
|
|
a1f57e1ab5 | ||
|
|
c2d2e93f07 | ||
|
|
56bdeb3ee9 | ||
|
|
b811ae890a | ||
|
|
07a444367b | ||
|
|
9f331306af | ||
|
|
83bca9318d | ||
|
|
32e2ecea37 |
3
account_analytic_analysis_usability/__init__.py
Normal file
3
account_analytic_analysis_usability/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import account_analytic_analysis
|
||||||
29
account_analytic_analysis_usability/__openerp__.py
Normal file
29
account_analytic_analysis_usability/__openerp__.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Account Analytic Analysis Usability',
|
||||||
|
'version': '8.0.1.0.0',
|
||||||
|
'category': 'Accounting & Finance',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Usability improvements on Account Analytic Analysis',
|
||||||
|
'description': """
|
||||||
|
Account Analytic Analysis Usability
|
||||||
|
===================================
|
||||||
|
|
||||||
|
Usability improvements include:
|
||||||
|
|
||||||
|
* add next invoice date in tree view of contrats (and add a group by)
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion
|
||||||
|
<alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['account_analytic_analysis'],
|
||||||
|
'data': [
|
||||||
|
'analytic_view.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAnalyticAccount(models.Model):
|
||||||
|
_inherit = "account.analytic.account"
|
||||||
|
|
||||||
|
recurring_next_date = fields.Date(track_visibility='onchange')
|
||||||
|
recurring_rule_type = fields.Selection(track_visibility='onchange')
|
||||||
|
recurring_interval = fields.Integer(track_visibility='onchange')
|
||||||
|
recurring_invoices = fields.Boolean(track_visibility='onchange')
|
||||||
40
account_analytic_analysis_usability/analytic_view.xml
Normal file
40
account_analytic_analysis_usability/analytic_view.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
|
||||||
|
<field name="name">usability.analytic_analysis.account.analytic.account.tree.contract</field>
|
||||||
|
<field name="model">account.analytic.account</field>
|
||||||
|
<field name="inherit_id" ref="account_analytic_analysis.view_account_analytic_account_tree_c2c_3"/>
|
||||||
|
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="date" position="after">
|
||||||
|
<field name="recurring_rule_type"/>
|
||||||
|
<field name="recurring_next_date"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_account_analytic_account_overdue_search" model="ir.ui.view">
|
||||||
|
<field name="name">usability.analytic_analysis.account.analytic.account.search</field>
|
||||||
|
<field name="model">account.analytic.account</field>
|
||||||
|
<field name="inherit_id" ref="account_analytic_analysis.view_account_analytic_account_overdue_search"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<filter context="{'group_by' : 'pricelist_id'}" position="after">
|
||||||
|
<filter name="recurring_rule_type_groupby" string="Invoicing Frequency" context="{'group_by': 'recurring_rule_type'}"/>
|
||||||
|
<filter name="recurring_next_date_groupby" string="Next Invoice Date" context="{'group_by': 'recurring_next_date'}"/>
|
||||||
|
</filter>
|
||||||
|
<filter name="cancelled" position="after">
|
||||||
|
<separator/>
|
||||||
|
<filter name="recurring_invoices" string="Recurring Invoicing" domain="[('recurring_invoices', '=', True)]"/>
|
||||||
|
</filter>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -45,5 +45,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_bank_statement_import'],
|
'depends': ['account_bank_statement_import'],
|
||||||
'data': ['account_view.xml'],
|
'data': ['account_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_credit_control', 'partner_aged_open_invoices'],
|
'depends': ['account_credit_control', 'partner_aged_open_invoices'],
|
||||||
'data': ['account_credit_control_view.xml'],
|
'data': ['account_credit_control_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
1
account_cutoff_accrual_picking_ods/__init__.py
Normal file
1
account_cutoff_accrual_picking_ods/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
24
account_cutoff_accrual_picking_ods/__openerp__.py
Normal file
24
account_cutoff_accrual_picking_ods/__openerp__.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Account Cutoff Accrual Picking ODS',
|
||||||
|
'version': '8.0.0.1.0',
|
||||||
|
'category': 'Tools',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Adds an Aeroo ODS report on cutoff accrual',
|
||||||
|
'description': """
|
||||||
|
Account Cutoff Accrual Picking ODS
|
||||||
|
==================================
|
||||||
|
|
||||||
|
This module will add an Aeroo ODS report on Accrued Revenue and Accrued Expense.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': "Akretion",
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['account_cutoff_accrual_picking', 'report_aeroo'],
|
||||||
|
'data': ['report.xml'],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
BIN
account_cutoff_accrual_picking_ods/cutoff_accrual.ods
Normal file
BIN
account_cutoff_accrual_picking_ods/cutoff_accrual.ods
Normal file
Binary file not shown.
27
account_cutoff_accrual_picking_ods/report.xml
Normal file
27
account_cutoff_accrual_picking_ods/report.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="account_cutoff_accrual_picking_ods" model="ir.actions.report.xml">
|
||||||
|
<field name="name">Cutoff Accrual ODS</field>
|
||||||
|
<field name="model">account.cutoff</field>
|
||||||
|
<field name="report_name">account.cutoff.accrual.picking.ods</field>
|
||||||
|
<field name="report_type">aeroo</field>
|
||||||
|
<field name="in_format">oo-ods</field>
|
||||||
|
<field name="report_rml">account_cutoff_accrual_picking_ods/cutoff_accrual.ods</field>
|
||||||
|
<field name="parser_state">default</field>
|
||||||
|
<field name="tml_source">file</field>
|
||||||
|
<field name="out_format" ref="report_aeroo.report_mimetypes_ods_ods"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="account_cutoff_accrual_picking_ods_button" model="ir.values">
|
||||||
|
<field name="name">Cutoff Accrual ODS</field>
|
||||||
|
<field name="model">account.cutoff</field>
|
||||||
|
<field name="key2">client_print_multi</field>
|
||||||
|
<field name="value" eval="'ir.actions.report.xml,%d'%account_cutoff_accrual_picking_ods"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_cutoff_prepaid', 'report_aeroo'],
|
'depends': ['account_cutoff_prepaid', 'report_aeroo'],
|
||||||
'data': ['report.xml'],
|
'data': ['report.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_banking_sepa_direct_debit', 'account_payment_partner'],
|
'depends': ['account_banking_sepa_direct_debit', 'account_payment_partner'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
3
account_fiscal_position_payable_receivable/__init__.py
Normal file
3
account_fiscal_position_payable_receivable/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import account_fiscal_position
|
||||||
26
account_fiscal_position_payable_receivable/__openerp__.py
Normal file
26
account_fiscal_position_payable_receivable/__openerp__.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Account Fiscal Position Payable Receivable',
|
||||||
|
'version': '8.0.1.0.0',
|
||||||
|
'category': 'Accounting & Finance',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Configure payable/receivable accounts on fiscal positions',
|
||||||
|
'description': """
|
||||||
|
Account Fiscal Position Payable Receivable
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
This module allows to configure a special *Partner Receivable Account* and a special *Partner Payable Account* on fiscal positions. This is used in the onchange of the fiscal position of partners.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': "Akretion",
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['account'],
|
||||||
|
'data': [
|
||||||
|
'account_fiscal_position_view.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class AccountFiscalPosition(models.Model):
|
||||||
|
_inherit = 'account.fiscal.position'
|
||||||
|
|
||||||
|
receivable_account_id = fields.Many2one(
|
||||||
|
'account.account', string='Partner Receivable Account',
|
||||||
|
company_dependent=True, domain=[('type', '=', 'receivable')])
|
||||||
|
payable_account_id = fields.Many2one(
|
||||||
|
'account.account', string='Partner Payable Account',
|
||||||
|
company_dependent=True, domain=[('type', '=', 'payable')])
|
||||||
|
|
||||||
|
|
||||||
|
class ResPartner(models.Model):
|
||||||
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
@api.onchange('property_account_position')
|
||||||
|
def fiscal_position_receivable_payable_change(self):
|
||||||
|
fp = self.property_account_position
|
||||||
|
ipo = self.env['ir.property']
|
||||||
|
if fp.receivable_account_id:
|
||||||
|
self.property_account_receivable = fp.receivable_account_id
|
||||||
|
else:
|
||||||
|
self.property_account_receivable = ipo.get(
|
||||||
|
'property_account_receivable', 'res.partner')
|
||||||
|
if fp.payable_account_id:
|
||||||
|
self.property_account_payable = fp.payable_account_id
|
||||||
|
else:
|
||||||
|
self.property_account_payable = ipo.get(
|
||||||
|
'property_account_payable', 'res.partner')
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_account_position_form" model="ir.ui.view">
|
||||||
|
<field name="name">receivable_payable.fiscal_position_form</field>
|
||||||
|
<field name="model">account.fiscal.position</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_position_form" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='country_group_id']/.." position="after">
|
||||||
|
<group string="Payable and Receivable Accounts"
|
||||||
|
name="payable_receivable_account" col="4">
|
||||||
|
<field name="receivable_account_id"/>
|
||||||
|
<field name="payable_account_id"/>
|
||||||
|
</group>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -39,5 +39,5 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,5 +26,5 @@ This module has been written by Alexis de Lattre from Akretion
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account', 'base_usability'],
|
'depends': ['account', 'base_usability'],
|
||||||
'data': ['account_view.xml'],
|
'data': ['account_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,5 +40,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'data': ['account_invoice_view.xml'],
|
'data': ['account_invoice_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion
|
|||||||
'data': [
|
'data': [
|
||||||
'account_invoice_view.xml',
|
'account_invoice_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,5 +37,5 @@ This module has been written by Alexis de Lattre from Akretion
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_invoice_margin', 'bi_invoice_company_currency'],
|
'depends': ['account_invoice_margin', 'bi_invoice_company_currency'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'data': ['company_view.xml'],
|
'data': ['company_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Adds a function field named *picking_ids_label* on invoices. This field contains
|
|||||||
'website': 'http://www.akretion.com/',
|
'website': 'http://www.akretion.com/',
|
||||||
'depends': ['stock_account'],
|
'depends': ['stock_account'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
'active': False,
|
'active': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['sale'],
|
'depends': ['sale'],
|
||||||
'data': ['account_invoice_view.xml'],
|
'data': ['account_invoice_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
'active': False,
|
'active': False,
|
||||||
}
|
}
|
||||||
|
|||||||
3
account_invoice_update_wizard/__init__.py
Normal file
3
account_invoice_update_wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import wizard
|
||||||
34
account_invoice_update_wizard/__openerp__.py
Normal file
34
account_invoice_update_wizard/__openerp__.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'Account Invoice Update Wizard',
|
||||||
|
'version': '8.0.1.0.0',
|
||||||
|
'category': 'Accounting & Finance',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Wizard to update non-legal fields of an open/paid invoice',
|
||||||
|
'description': """
|
||||||
|
Account Invoice Update Wizard
|
||||||
|
=============================
|
||||||
|
|
||||||
|
This module adds a button *Update Invoice* on Customer and Supplier invoices in Open or Paid state. This button starts a wizard which allows the user to update non-legal fields of the invoice:
|
||||||
|
|
||||||
|
* Source Document
|
||||||
|
* Reference/Description
|
||||||
|
* Payment terms (update allowed only to a payment term with same number of terms of the same amount and on invoices without any payment)
|
||||||
|
* Bank Account
|
||||||
|
* Salesman
|
||||||
|
* Notes
|
||||||
|
* Description of invoice lines
|
||||||
|
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['account'],
|
||||||
|
'data': [
|
||||||
|
'wizard/account_invoice_update_view.xml',
|
||||||
|
'views/account_invoice.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
31
account_invoice_update_wizard/views/account_invoice.xml
Normal file
31
account_invoice_update_wizard/views/account_invoice.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="invoice_supplier_form" model="ir.ui.view">
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="invoice_cancel" position="before">
|
||||||
|
<button name="%(account_invoice_update_action)d" type="action" string="Update Invoice" states="open,paid" groups="account.group_account_invoice"/>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="invoice_form" model="ir.ui.view">
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button name="invoice_cancel" position="before">
|
||||||
|
<button name="%(account_invoice_update_action)d" type="action" string="Update Invoice" states="open,paid" groups="account.group_account_invoice"/>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
3
account_invoice_update_wizard/wizard/__init__.py
Normal file
3
account_invoice_update_wizard/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import account_invoice_update
|
||||||
206
account_invoice_update_wizard/wizard/account_invoice_update.py
Normal file
206
account_invoice_update_wizard/wizard/account_invoice_update.py
Normal file
@@ -0,0 +1,206 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api, _
|
||||||
|
from openerp.exceptions import Warning as UserError
|
||||||
|
import openerp.addons.decimal_precision as dp
|
||||||
|
|
||||||
|
|
||||||
|
class AccountInvoiceUpdate(models.TransientModel):
|
||||||
|
_name = 'account.invoice.update'
|
||||||
|
_description = 'Wizard to update non-legal fields of invoice'
|
||||||
|
|
||||||
|
invoice_id = fields.Many2one(
|
||||||
|
'account.invoice', string='Invoice', required=True,
|
||||||
|
readonly=True)
|
||||||
|
type = fields.Selection(related='invoice_id.type', readonly=True)
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
related='invoice_id.company_id', readonly=True)
|
||||||
|
commercial_partner_id = fields.Many2one(
|
||||||
|
related='invoice_id.commercial_partner_id', readonly=True)
|
||||||
|
user_id = fields.Many2one('res.users', string='Salesperson')
|
||||||
|
# I use the same field name as the original invoice field name
|
||||||
|
# even if it the name is "bad"
|
||||||
|
# Updating payment_term will not work if you use
|
||||||
|
# the OCA module account_constraints (you will just get an error)
|
||||||
|
payment_term = fields.Many2one(
|
||||||
|
'account.payment.term', string='Payment Terms')
|
||||||
|
reference = fields.Char(string='Invoice Reference')
|
||||||
|
name = fields.Char(string='Reference/Description')
|
||||||
|
origin = fields.Char(string='Source Document')
|
||||||
|
comment = fields.Text('Additional Information')
|
||||||
|
partner_bank_id = fields.Many2one(
|
||||||
|
'res.partner.bank', string='Bank Account')
|
||||||
|
line_ids = fields.One2many(
|
||||||
|
'account.invoice.line.update', 'parent_id', string='Invoice Lines')
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _simple_fields2update(self):
|
||||||
|
'''List boolean, date, datetime, char, text fields'''
|
||||||
|
return ['reference', 'name', 'origin', 'comment']
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _m2o_fields2update(self):
|
||||||
|
return ['payment_term', 'user_id', 'partner_bank_id']
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_default_get(self, invoice):
|
||||||
|
res = {'invoice_id': invoice.id, 'line_ids': []}
|
||||||
|
for sfield in self._simple_fields2update():
|
||||||
|
res[sfield] = invoice[sfield]
|
||||||
|
for m2ofield in self._m2o_fields2update():
|
||||||
|
res[m2ofield] = invoice[m2ofield].id or False
|
||||||
|
for line in invoice.invoice_line:
|
||||||
|
res['line_ids'].append({
|
||||||
|
'invoice_line_id': line.id,
|
||||||
|
'name': line.name,
|
||||||
|
'quantity': line.quantity,
|
||||||
|
'price_subtotal': line.price_subtotal,
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def default_get(self, fields_list):
|
||||||
|
res = super(AccountInvoiceUpdate, self).default_get(fields_list)
|
||||||
|
assert self._context.get('active_model') == 'account.invoice',\
|
||||||
|
'active_model should be account.invoice'
|
||||||
|
inv = self.env['account.invoice'].browse(self._context['active_id'])
|
||||||
|
res = self._prepare_default_get(inv)
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.onchange('type')
|
||||||
|
def type_on_change(self):
|
||||||
|
res = {'domain': {}}
|
||||||
|
if self.type in ('out_invoice', 'out_refund'):
|
||||||
|
res['domain']['partner_bank_id'] =\
|
||||||
|
"[('partner_id.ref_companies', 'in', [company_id])]"
|
||||||
|
else:
|
||||||
|
res['domain']['partner_bank_id'] =\
|
||||||
|
"[('partner_id', '=', commercial_partner_id)]"
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _prepare_invoice(self):
|
||||||
|
vals = {}
|
||||||
|
inv = self.invoice_id
|
||||||
|
for sfield in self._simple_fields2update():
|
||||||
|
if self[sfield] != inv[sfield]:
|
||||||
|
vals[sfield] = self[sfield]
|
||||||
|
for m2ofield in self._m2o_fields2update():
|
||||||
|
if self[m2ofield] != inv[m2ofield]:
|
||||||
|
vals[m2ofield] = self[m2ofield].id or False
|
||||||
|
if 'payment_term' in vals:
|
||||||
|
pterm_list = self.payment_term.compute(
|
||||||
|
value=1, date_ref=inv.date_invoice)[0]
|
||||||
|
if pterm_list:
|
||||||
|
vals['date_due'] = max(line[0] for line in pterm_list)
|
||||||
|
return vals
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _prepare_invoice_line(self, line):
|
||||||
|
vals = {}
|
||||||
|
if line.name != line.invoice_line_id.name:
|
||||||
|
vals['name'] = line.name
|
||||||
|
return vals
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _prepare_move(self):
|
||||||
|
mvals = {}
|
||||||
|
inv = self.invoice_id
|
||||||
|
ini_ref = inv.move_id.ref
|
||||||
|
ref = inv.reference or inv.name
|
||||||
|
if ini_ref != ref:
|
||||||
|
mvals['ref'] = ref
|
||||||
|
return mvals
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _update_payment_term_move(self):
|
||||||
|
self.ensure_one()
|
||||||
|
inv = self.invoice_id
|
||||||
|
if (
|
||||||
|
self.payment_term and
|
||||||
|
self.payment_term != inv.payment_term and
|
||||||
|
inv.move_id and
|
||||||
|
inv.move_id.period_id.state == 'draft'):
|
||||||
|
# I don't update pay term when the invoice is partially (or fully)
|
||||||
|
# paid because if you have a payment term with several lines
|
||||||
|
# of the same amount, you would also have to take into account
|
||||||
|
# the reconcile marks to put the new maturity date on the right
|
||||||
|
# lines
|
||||||
|
if inv.payment_ids:
|
||||||
|
raise UserError(_(
|
||||||
|
"This wizard doesn't support the update of payment "
|
||||||
|
"terms on an invoice which is partially or fully "
|
||||||
|
"paid."))
|
||||||
|
prec = self.env['decimal.precision'].precision_get('Account')
|
||||||
|
term_res = self.payment_term.compute(
|
||||||
|
inv.amount_total, inv.date_invoice)[0]
|
||||||
|
new_pterm = {} # key = int(amount * 100), value = [date1, date2]
|
||||||
|
for entry in term_res:
|
||||||
|
amount = int(entry[1] * 10 * prec)
|
||||||
|
if amount in new_pterm:
|
||||||
|
new_pterm[amount].append(entry[0])
|
||||||
|
else:
|
||||||
|
new_pterm[amount] = [entry[0]]
|
||||||
|
mlines = {} # key = int(amount * 100), value : [line1, line2]
|
||||||
|
for line in inv.move_id.line_id:
|
||||||
|
if line.account_id == inv.account_id:
|
||||||
|
amount = int(abs(line.credit - line.debit) * 10 * prec)
|
||||||
|
if amount in mlines:
|
||||||
|
mlines[amount].append(line)
|
||||||
|
else:
|
||||||
|
mlines[amount] = [line]
|
||||||
|
for iamount, lines in mlines.iteritems():
|
||||||
|
if len(lines) != len(new_pterm.get(iamount, [])):
|
||||||
|
raise UserError(_(
|
||||||
|
"The original payment term '%s' doesn't have the "
|
||||||
|
"same terms (number of terms and/or amount) as the "
|
||||||
|
"new payment term '%s'. You can only switch to a "
|
||||||
|
"payment term that has the same number of terms "
|
||||||
|
"with the same amount.") % (
|
||||||
|
inv.payment_term.name, self.payment_term.name))
|
||||||
|
for line in lines:
|
||||||
|
line.date_maturity = new_pterm[iamount].pop()
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def run(self):
|
||||||
|
self.ensure_one()
|
||||||
|
inv = self.invoice_id
|
||||||
|
updated = False
|
||||||
|
# re-write date_maturity on move line
|
||||||
|
self._update_payment_term_move()
|
||||||
|
ivals = self._prepare_invoice()
|
||||||
|
if ivals:
|
||||||
|
updated = True
|
||||||
|
inv.write(ivals)
|
||||||
|
for line in self.line_ids:
|
||||||
|
ilvals = self._prepare_invoice_line(line)
|
||||||
|
if ilvals:
|
||||||
|
updated = True
|
||||||
|
line.invoice_line_id.write(ilvals)
|
||||||
|
if inv.move_id and inv.move_id.period_id.state == 'draft':
|
||||||
|
mvals = self._prepare_move()
|
||||||
|
if mvals:
|
||||||
|
inv.move_id.write(mvals)
|
||||||
|
if updated:
|
||||||
|
inv.message_post(_(
|
||||||
|
'Non-legal fields of invoice updated via the Invoice Update '
|
||||||
|
'wizard.'))
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class AccountInvoiceLineUpdate(models.TransientModel):
|
||||||
|
_name = 'account.invoice.line.update'
|
||||||
|
_description = 'Update non-legal fields of invoice lines'
|
||||||
|
|
||||||
|
parent_id = fields.Many2one(
|
||||||
|
'account.invoice.update', string='Wizard', ondelete='cascade')
|
||||||
|
invoice_line_id = fields.Many2one(
|
||||||
|
'account.invoice.line', string='Invoice Line', readonly=True)
|
||||||
|
name = fields.Text(string='Description', required=True)
|
||||||
|
quantity = fields.Float(
|
||||||
|
string='Quantity', digits=dp.get_precision('Product Unit of Measure'),
|
||||||
|
readonly=True)
|
||||||
|
price_subtotal = fields.Float(
|
||||||
|
string='Amount', readonly=True, digits=dp.get_precision('Account'))
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="account_invoice_update_form" model="ir.ui.view">
|
||||||
|
<field name="model">account.invoice.update</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Update Invoice Wizard">
|
||||||
|
<group name="main">
|
||||||
|
<field name="invoice_id" invisible="1"/>
|
||||||
|
<field name="type" invisible="1"/>
|
||||||
|
<field name="company_id" invisible="1"/>
|
||||||
|
<field name="commercial_partner_id" invisible="1"/>
|
||||||
|
<field name="reference" attrs="{'invisible': [('type', 'not in', ('in_invoice', 'in_refund'))]}"/>
|
||||||
|
<field name="origin"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="payment_term" widget="selection"/>
|
||||||
|
<field name="partner_bank_id"/>
|
||||||
|
<field name="user_id"/>
|
||||||
|
<field name="comment"/>
|
||||||
|
</group>
|
||||||
|
<group name="lines">
|
||||||
|
<field name="line_ids" nolabel="1">
|
||||||
|
<tree editable="bottom">
|
||||||
|
<field name="invoice_line_id" invisible="1"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="quantity"/>
|
||||||
|
<field name="price_subtotal"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button name="run" type="object" class="oe_highlight" string="Update"/>
|
||||||
|
or
|
||||||
|
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="account_invoice_update_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Invoice Update Wizard</field>
|
||||||
|
<field name="res_model">account.invoice.update</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_usability'],
|
'depends': ['account_usability'],
|
||||||
'data': ['wizard/account_move_line_filter_view.xml'],
|
'data': ['wizard/account_move_line_filter_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,10 @@ class AccountMoveLineFilterWizard(models.TransientModel):
|
|||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||||
'account', 'action_account_moves_all_a')
|
'account', 'action_account_moves_all_a')
|
||||||
action['context'] = {'search_default_account_id': [self.account_id.id]}
|
action['context'] = {
|
||||||
|
'search_default_account_id': [self.account_id.id],
|
||||||
|
'journal_show_code_only': True,
|
||||||
|
}
|
||||||
if self.partner_id:
|
if self.partner_id:
|
||||||
action['context']['search_default_partner_id'] =\
|
action['context']['search_default_partner_id'] =\
|
||||||
[self.partner_id.id]
|
[self.partner_id.id]
|
||||||
|
|||||||
@@ -40,5 +40,5 @@ This module has been written by Alexis de Lattre from Akretion
|
|||||||
'website': 'http://www.akretion.com/',
|
'website': 'http://www.akretion.com/',
|
||||||
'depends': ['account_cutoff_prepaid', 'account_move_line_report_xls'],
|
'depends': ['account_cutoff_prepaid', 'account_move_line_report_xls'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,16 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import xlwt
|
import xlwt
|
||||||
|
import logging
|
||||||
from openerp import models, api
|
from openerp import models, api
|
||||||
from openerp.addons.report_xls.utils import _render
|
|
||||||
from openerp.addons.report_xls.report_xls import report_xls
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from openerp.addons.report_xls.utils import _render
|
||||||
|
from openerp.addons.report_xls.report_xls import report_xls
|
||||||
|
except (ImportError, IOError) as err:
|
||||||
|
_logger.debug(err)
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
|
|||||||
@@ -37,4 +37,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'author': 'Akretion',
|
'author': 'Akretion',
|
||||||
'depends': ['account_payment'],
|
'depends': ['account_payment'],
|
||||||
'data': ['payment_view.xml'],
|
'data': ['payment_view.xml'],
|
||||||
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,4 +40,5 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'payment_view.xml',
|
'payment_view.xml',
|
||||||
],
|
],
|
||||||
'active': False,
|
'active': False,
|
||||||
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,5 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
],
|
],
|
||||||
'active': False,
|
'active': False,
|
||||||
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Account Usability',
|
'name': 'Account Usability',
|
||||||
'version': '0.1',
|
'version': '0.3',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Small usability enhancements in account module',
|
'summary': 'Small usability enhancements in account module',
|
||||||
@@ -50,5 +50,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'conflicts': ['account_invoice_overdue_filter'],
|
'conflicts': ['account_invoice_overdue_filter'],
|
||||||
'data': ['account_view.xml'],
|
'data': ['account_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
from openerp import models, fields, api, _
|
from openerp import models, fields, api, _
|
||||||
from openerp.tools import float_compare
|
from openerp.tools import float_compare
|
||||||
from openerp.exceptions import Warning as UserError
|
from openerp.exceptions import Warning as UserError
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AccountInvoice(models.Model):
|
class AccountInvoice(models.Model):
|
||||||
@@ -43,16 +45,53 @@ class AccountInvoice(models.Model):
|
|||||||
fiscal_position = fields.Many2one(track_visibility='onchange')
|
fiscal_position = fields.Many2one(track_visibility='onchange')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_move_create(self):
|
def onchange_payment_term_date_invoice(
|
||||||
today = fields.Date.context_today(self)
|
self, payment_term_id, date_invoice):
|
||||||
for invoice in self:
|
res = super(AccountInvoice, self).onchange_payment_term_date_invoice(
|
||||||
if invoice.date_invoice and invoice.date_invoice > today:
|
payment_term_id, date_invoice)
|
||||||
raise UserError(_(
|
if res and isinstance(res, dict) and 'value' in res:
|
||||||
"You cannot validate the invoice of '%s' "
|
res['value']['period_id'] = False
|
||||||
" with an invoice date (%s) in the future !") % (
|
return res
|
||||||
invoice.partner_id.name_get()[0][1],
|
|
||||||
invoice.date_invoice))
|
# I really hate to see a "/" in the 'name' field of the account.move.line
|
||||||
return super(AccountInvoice, self).action_move_create()
|
# generated from customer invoices linked to the partners' account because:
|
||||||
|
# 1) the label of an account move line is an important field, we can't
|
||||||
|
# write a rubbish '/' in it !
|
||||||
|
# 2) the 'name' field of the account.move.line is used in the overdue
|
||||||
|
# letter and '/' is not meaningful for our customer !
|
||||||
|
@api.multi
|
||||||
|
def action_number(self):
|
||||||
|
res = super(AccountInvoice, self).action_number()
|
||||||
|
for inv in self:
|
||||||
|
self._cr.execute(
|
||||||
|
"UPDATE account_move_line SET name= "
|
||||||
|
"CASE WHEN name='/' THEN %s "
|
||||||
|
"ELSE %s||' - '||name END "
|
||||||
|
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
|
||||||
|
self.invalidate_cache()
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
class AccountInvoiceLine(models.Model):
|
||||||
|
_inherit = 'account.invoice.line'
|
||||||
|
|
||||||
|
# In the 'account' module, we have related stored field for:
|
||||||
|
# company_id, partner_id
|
||||||
|
currency_id = fields.Many2one(
|
||||||
|
related='invoice_id.currency_id', readonly=True, store=True)
|
||||||
|
invoice_type = fields.Selection(
|
||||||
|
related='invoice_id.type', store=True, readonly=True)
|
||||||
|
date_invoice = fields.Date(
|
||||||
|
related='invoice_id.date_invoice', store=True, readonly=True)
|
||||||
|
commercial_partner_id = fields.Many2one(
|
||||||
|
related='invoice_id.partner_id.commercial_partner_id',
|
||||||
|
store=True, readonly=True)
|
||||||
|
state = fields.Selection(
|
||||||
|
related='invoice_id.state', store=True, readonly=True,
|
||||||
|
string='Invoice State')
|
||||||
|
invoice_number = fields.Char(
|
||||||
|
related='invoice_id.move_id.name', store=True, readonly=True,
|
||||||
|
string='Invoice Number')
|
||||||
|
|
||||||
|
|
||||||
class AccountFiscalYear(models.Model):
|
class AccountFiscalYear(models.Model):
|
||||||
@@ -91,10 +130,36 @@ class AccountAccount(models.Model):
|
|||||||
else:
|
else:
|
||||||
return super(AccountAccount, self).name_get()
|
return super(AccountAccount, self).name_get()
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def check_account_hierarchy(self):
|
||||||
|
'''designed to be called by a script'''
|
||||||
|
accounts = self.env['account.account'].search([])
|
||||||
|
parent_accounts = self
|
||||||
|
for account in accounts:
|
||||||
|
if account.parent_id and account.parent_id not in parent_accounts:
|
||||||
|
parent_accounts += account.parent_id
|
||||||
|
err_msg = []
|
||||||
|
view_user_type = self.env.ref('account.data_account_type_view')
|
||||||
|
for pacc in parent_accounts:
|
||||||
|
if pacc.type != 'view':
|
||||||
|
err_msg.append(_(
|
||||||
|
'Parent account %s should have type=view '
|
||||||
|
'(current type=%s)') % (pacc.code, pacc.type))
|
||||||
|
if pacc.user_type != view_user_type:
|
||||||
|
err_msg.append(_(
|
||||||
|
'Parent account %s should have user_type=view (current '
|
||||||
|
'(user_type=%s)') % (pacc.code, pacc.user_type.name))
|
||||||
|
if err_msg:
|
||||||
|
raise UserError('\n'.join(err_msg))
|
||||||
|
|
||||||
|
|
||||||
class AccountAnalyticAccount(models.Model):
|
class AccountAnalyticAccount(models.Model):
|
||||||
_inherit = 'account.analytic.account'
|
_inherit = 'account.analytic.account'
|
||||||
|
|
||||||
|
invoice_line_ids = fields.One2many(
|
||||||
|
'account.invoice.line', 'account_analytic_id', 'Invoice Lines',
|
||||||
|
readonly=True)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def name_get(self):
|
def name_get(self):
|
||||||
if self._context.get('analytic_account_show_code_only'):
|
if self._context.get('analytic_account_show_code_only'):
|
||||||
@@ -111,11 +176,51 @@ class AccountAnalyticAccount(models.Model):
|
|||||||
class AccountMove(models.Model):
|
class AccountMove(models.Model):
|
||||||
_inherit = 'account.move'
|
_inherit = 'account.move'
|
||||||
|
|
||||||
|
# When ref is too long, the PDF general ledger report becomes
|
||||||
|
# unreadable
|
||||||
|
ref = fields.Char(size=32)
|
||||||
|
# If you want to migrate existing data :
|
||||||
|
# update account_move set ref=left(ref,32) where ref is not null;
|
||||||
|
# update account_move_line set ref=left(ref,32) where ref is not null;
|
||||||
|
|
||||||
@api.onchange('date')
|
@api.onchange('date')
|
||||||
def date_onchange(self):
|
def date_onchange(self):
|
||||||
if self.date:
|
if self.date:
|
||||||
self.period_id = self.env['account.period'].find(self.date)
|
self.period_id = self.env['account.period'].find(self.date)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def delete_move_no_lines(self):
|
||||||
|
'''designed to be called by a script'''
|
||||||
|
moves_no_lines = self.search([('line_id', '=', False)])
|
||||||
|
inv_moves_sr = self.env['account.invoice'].search_read(
|
||||||
|
[('move_id', '!=', False)], ['move_id'])
|
||||||
|
move2inv = {} # key=move_id, value=invoice_id
|
||||||
|
invoice_move_no_line = {} # key=ID, value=number
|
||||||
|
deleted_move_ids = []
|
||||||
|
for inv_move_sr in inv_moves_sr:
|
||||||
|
move2inv[inv_move_sr['move_id'][0]] = inv_move_sr['id']
|
||||||
|
for move in moves_no_lines:
|
||||||
|
for l in move.line_id:
|
||||||
|
raise UserError(_('Move %d has a line !') % move.id)
|
||||||
|
if move.id not in move2inv:
|
||||||
|
if move.state == 'posted':
|
||||||
|
move.state = 'draft'
|
||||||
|
deleted_move_ids.append(move.id)
|
||||||
|
move.unlink()
|
||||||
|
else:
|
||||||
|
invoice_move_no_line[move2inv[move.id]] = move.name
|
||||||
|
if deleted_move_ids:
|
||||||
|
logger.info(
|
||||||
|
'Account move IDs %s have been deleted because they '
|
||||||
|
'had 0 lines', deleted_move_ids)
|
||||||
|
else:
|
||||||
|
logger.info('0 moves without lines found')
|
||||||
|
if invoice_move_no_line:
|
||||||
|
for inv_id, inv_number in invoice_move_no_line.iteritems():
|
||||||
|
logger.info(
|
||||||
|
'Invoice ID %d number %s has a move with 0 lines',
|
||||||
|
inv_id, inv_number)
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
_inherit = 'account.move.line'
|
_inherit = 'account.move.line'
|
||||||
@@ -149,6 +254,28 @@ class AccountMoveLine(models.Model):
|
|||||||
else:
|
else:
|
||||||
self.credit = amount_company_currency
|
self.credit = amount_company_currency
|
||||||
|
|
||||||
|
analytic_account_id = fields.Many2one(
|
||||||
|
domain=[('type', 'not in', ('view', 'template'))])
|
||||||
|
|
||||||
|
|
||||||
|
class AccountBankStatement(models.Model):
|
||||||
|
_inherit = 'account.bank.statement'
|
||||||
|
|
||||||
|
start_date = fields.Date(
|
||||||
|
compute='_compute_dates', string='Start Date', readonly=True,
|
||||||
|
store=True)
|
||||||
|
end_date = fields.Date(
|
||||||
|
compute='_compute_dates', string='End Date', readonly=True,
|
||||||
|
store=True)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
@api.depends('line_ids.date')
|
||||||
|
def _compute_dates(self):
|
||||||
|
for st in self:
|
||||||
|
dates = [line.date for line in st.line_ids]
|
||||||
|
st.start_date = dates and min(dates) or False
|
||||||
|
st.end_date = dates and max(dates) or False
|
||||||
|
|
||||||
|
|
||||||
class AccountBankStatementLine(models.Model):
|
class AccountBankStatementLine(models.Model):
|
||||||
_inherit = 'account.bank.statement.line'
|
_inherit = 'account.bank.statement.line'
|
||||||
@@ -196,6 +323,7 @@ class AccountBankStatementLine(models.Model):
|
|||||||
raise UserError(_(
|
raise UserError(_(
|
||||||
'No journal entry linked to this bank statement line.'))
|
'No journal entry linked to this bank statement line.'))
|
||||||
|
|
||||||
|
|
||||||
class ResPartner(models.Model):
|
class ResPartner(models.Model):
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,118 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- Having a menu entry on invoice lines is often very usefull for odoo user:
|
||||||
|
they can search in their lines, etc...
|
||||||
|
So I enhance the generic views and add actions, but I don't add menu entries here ;
|
||||||
|
the creation of the corresponding menu entry should be done in the customer-specific
|
||||||
|
module -->
|
||||||
|
<record id="view_invoice_line_tree" model="ir.ui.view">
|
||||||
|
<field name="name">account_usability.invoice_line_tree</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="inherit_id" ref="account.view_invoice_line_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="name" position="before">
|
||||||
|
<field name="partner_id" invisible="not context.get('show_invoice_fields')"/>
|
||||||
|
<field name="date_invoice" invisible="not context.get('show_invoice_fields')"/>
|
||||||
|
<field name="invoice_number" invisible="not context.get('show_invoice_fields')"/>
|
||||||
|
</field>
|
||||||
|
<field name="price_subtotal" position="after">
|
||||||
|
<field name="currency_id"/>
|
||||||
|
<field name="state" invisible="not context.get('show_invoice_fields')"/>
|
||||||
|
<field name="invoice_type" invisible="1"/>
|
||||||
|
</field>
|
||||||
|
<xpath expr="/tree" position="attributes">
|
||||||
|
<attribute name="edit">0</attribute>
|
||||||
|
<attribute name="create">0</attribute>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="account_invoice_line_search" model="ir.ui.view">
|
||||||
|
<field name="name">account_usability.invoice_line_search</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Search Invoice Lines">
|
||||||
|
<field name="partner_id"/>
|
||||||
|
<field name="product_id"/>
|
||||||
|
<field name="account_id"/>
|
||||||
|
<field name="invoice_number"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<filter name="out_invoice" string="Customer Invoices"
|
||||||
|
domain="[('invoice_type', '=', 'out_invoice')]"/>
|
||||||
|
<filter name="out_refund" string="Customer Refunds"
|
||||||
|
domain="[('invoice_type', '=', 'out_refund')]"/>
|
||||||
|
<filter name="in_invoice" string="Supplier Invoices"
|
||||||
|
domain="[('invoice_type', '=', 'in_invoice')]"/>
|
||||||
|
<filter name="in_refund" string="Supplier Refunds"
|
||||||
|
domain="[('invoice_type', '=', 'in_refund')]"/>
|
||||||
|
<separator/>
|
||||||
|
<filter name="draft" string="Draft" domain="[('state', '=', 'draft')]"/>
|
||||||
|
<filter name="unpaid" string="Not Paid" domain="[('state', '=', 'open')]"/>
|
||||||
|
<filter name="paid" string="Paid" domain="[('state', '=', 'paid')]"/>
|
||||||
|
|
||||||
|
<group string="Group By" name="groupby">
|
||||||
|
<filter name="partner_groupby" string="Partner"
|
||||||
|
context="{'group_by': 'partner_id'}"/>
|
||||||
|
<filter name="commercial_partner_group_by" string="Commercial Partner"
|
||||||
|
context="{'group_by': 'commercial_partner_id'}"/>
|
||||||
|
<filter name="date_groupby" string="Invoice Date"
|
||||||
|
context="{'group_by': 'date_invoice'}"/>
|
||||||
|
<filter name="product_groupby" string="Product"
|
||||||
|
context="{'group_by': 'product_id'}"/>
|
||||||
|
<filter name="account_groupby" string="Account"
|
||||||
|
context="{'group_by': 'account_id'}"/>
|
||||||
|
</group>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="out_invoice_line_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Customer Invoice Lines</field>
|
||||||
|
<field name="res_model">account.invoice.line</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[('invoice_type', '=', 'out_invoice')]</field>
|
||||||
|
<field name="context">{'show_invoice_fields': True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="out_refund_line_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Customer Refund Lines</field>
|
||||||
|
<field name="res_model">account.invoice.line</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[('invoice_type', '=', 'out_refund')]</field>
|
||||||
|
<field name="context">{'show_invoice_fields': True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="in_invoice_line_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Supplier Invoice Lines</field>
|
||||||
|
<field name="res_model">account.invoice.line</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[('invoice_type', '=', 'in_invoice')]</field>
|
||||||
|
<field name="context">{'show_invoice_fields': True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="in_refund_line_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Supplier Refund Lines</field>
|
||||||
|
<field name="res_model">account.invoice.line</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[('invoice_type', '=', 'in_refund')]</field>
|
||||||
|
<field name="context">{'show_invoice_fields': True}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_account_invoice_report_search" model="ir.ui.view">
|
||||||
|
<field name="name">usability.account.invoice.report.search</field>
|
||||||
|
<field name="model">account.invoice.report</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_invoice_report_search"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="categ_id" position="after">
|
||||||
|
<field name="product_id"/>
|
||||||
|
</field>
|
||||||
|
<filter name="category_product" position="after">
|
||||||
|
<filter string="Product" name="product_group_by" context="{'group_by': 'product_id'}"/>
|
||||||
|
</filter>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- model account.move.line / Journal Items -->
|
<!-- model account.move.line / Journal Items -->
|
||||||
<record id="account.action_account_moves_all_a" model="ir.actions.act_window">
|
<record id="account.action_account_moves_all_a" model="ir.actions.act_window">
|
||||||
<field name="limit">200</field>
|
<field name="limit">200</field>
|
||||||
@@ -101,6 +213,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="partner_id" position="after">
|
<field name="partner_id" position="after">
|
||||||
<field name="reconcile_ref" />
|
<field name="reconcile_ref" />
|
||||||
|
<field name="debit" filter_domain="['|', ('debit', '=', self), ('credit', '=', self)]" string="Debit or Credit"/>
|
||||||
</field>
|
</field>
|
||||||
<filter name="unreconciled" position="before">
|
<filter name="unreconciled" position="before">
|
||||||
<filter name="reconciled" string="Fully Reconciled" domain="[('reconcile_id', '!=', False)]"/>
|
<filter name="reconciled" string="Fully Reconciled" domain="[('reconcile_id', '!=', False)]"/>
|
||||||
@@ -128,10 +241,18 @@
|
|||||||
<field name="name">account_usability.account_move_line_tree</field>
|
<field name="name">account_usability.account_move_line_tree</field>
|
||||||
<field name="model">account.move.line</field>
|
<field name="model">account.move.line</field>
|
||||||
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
||||||
|
<field name="priority">1</field> <!-- to be compatible with account_analytic_plans which removes the field analytic_account_id and has a priority of 2 -->
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="analytic_account_id" position="attributes">
|
<field name="analytic_account_id" position="attributes">
|
||||||
<attribute name="invisible"></attribute>
|
<attribute name="invisible"></attribute>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="reconcile_ref" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="reconcile_ref" position="after">
|
||||||
|
<field name="reconcile_id"/>
|
||||||
|
<field name="reconcile_partial_id"/>
|
||||||
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -182,6 +303,12 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- When you click on the "Contract" button of partner form view,
|
||||||
|
the newly created analytic accounts should be of type contract ! -->
|
||||||
|
<record id="account.action_open_partner_analytic_accounts" model="ir.actions.act_window">
|
||||||
|
<field name="context">{'search_default_partner_id': [active_id], 'default_partner_id': active_id, 'default_type': 'contract'}</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="view_bank_statement_form" model="ir.ui.view">
|
<record id="view_bank_statement_form" model="ir.ui.view">
|
||||||
<field name="name">usability.account.bank.statement.form</field>
|
<field name="name">usability.account.bank.statement.form</field>
|
||||||
<field name="model">account.bank.statement</field>
|
<field name="model">account.bank.statement</field>
|
||||||
@@ -193,6 +320,65 @@
|
|||||||
string="View Account Move" icon="gtk-redo"
|
string="View Account Move" icon="gtk-redo"
|
||||||
attrs="{'invisible': [('journal_entry_id', '=', False)]}"/>
|
attrs="{'invisible': [('journal_entry_id', '=', False)]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<field name="company_id" position="before">
|
||||||
|
<field name="start_date"/>
|
||||||
|
<field name="end_date"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_bank_statement_tree" model="ir.ui.view">
|
||||||
|
<field name="name">usability.account.bank.statement.tree</field>
|
||||||
|
<field name="model">account.bank.statement</field>
|
||||||
|
<field name="inherit_id" ref="account.view_bank_statement_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="period_id" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="date" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="journal_id" position="after">
|
||||||
|
<field name="start_date"/>
|
||||||
|
<field name="end_date"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_bank_statement_search" model="ir.ui.view">
|
||||||
|
<field name="name">usability.account.bank.statement.search</field>
|
||||||
|
<field name="model">account.bank.statement</field>
|
||||||
|
<field name="inherit_id" ref="account.view_bank_statement_search"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="date" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<filter context="{'group_by': 'period_id'}" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</filter>
|
||||||
|
<filter context="{'group_by': 'period_id'}" position="after">
|
||||||
|
<filter name="start_date_groupby" string="Start Date"
|
||||||
|
context="{'group_by': 'start_date'}"/>
|
||||||
|
<filter name="end_date_groupby" string="End Date"
|
||||||
|
context="{'group_by': 'end_date'}"/>
|
||||||
|
</filter>
|
||||||
|
<field name="date" position="after">
|
||||||
|
<field name="start_date"/>
|
||||||
|
<field name="end_date"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_account_analytic_account_form" model="ir.ui.view">
|
||||||
|
<field name="name">analytic.analytic.account.form</field>
|
||||||
|
<field name="model">account.analytic.account</field>
|
||||||
|
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<notebook position="inside">
|
||||||
|
<page name="invoice_lines" string="Related Invoice Lines" attrs="{'invisible': [('type', 'not in', ('contract', 'normal'))]}">
|
||||||
|
<field name="invoice_line_ids" nolabel="1" context="{'show_invoice_fields': 1}"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
17
account_usability/migrations/8.0.0.2/pre-migration.py
Normal file
17
account_usability/migrations/8.0.0.2/pre-migration.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
def migrate(cr, version):
|
||||||
|
if not version:
|
||||||
|
return
|
||||||
|
|
||||||
|
# cf the inherit of action_number() of account.invoice
|
||||||
|
# in account_usability/account.py
|
||||||
|
cr.execute(
|
||||||
|
"UPDATE account_move_line SET name= "
|
||||||
|
"CASE WHEN account_move_line.name='/' THEN account_move.name "
|
||||||
|
"ELSE account_move.name||' - '||account_move_line.name END "
|
||||||
|
"FROM account_move WHERE account_move_line.move_id = account_move.id "
|
||||||
|
"AND account_move_line.journal_id in "
|
||||||
|
"(SELECT id FROM account_journal WHERE type in ('sale', 'sale_refund'))")
|
||||||
16
account_usability/migrations/8.0.0.3/pre-migration.py
Normal file
16
account_usability/migrations/8.0.0.3/pre-migration.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
def migrate(cr, version):
|
||||||
|
if not version:
|
||||||
|
return
|
||||||
|
|
||||||
|
# cf the inherit of action_number() of account.invoice
|
||||||
|
# in account_usability/account.py
|
||||||
|
cr.execute(
|
||||||
|
"UPDATE account_move_line SET name=account_move.name "
|
||||||
|
"FROM account_move WHERE account_move_line.move_id = account_move.id "
|
||||||
|
"AND account_move_line.name='/' "
|
||||||
|
"AND account_move_line.journal_id in "
|
||||||
|
"(SELECT id FROM account_journal WHERE type in ('purchase', 'purchase_refund'))")
|
||||||
BIN
account_usability/static/description/icon.png
Normal file
BIN
account_usability/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account_voucher'],
|
'depends': ['account_voucher'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,5 +48,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'report_aeroo',
|
'report_aeroo',
|
||||||
'base_other_report_engines',
|
'base_other_report_engines',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ Contributors: David BEAL
|
|||||||
'data': [
|
'data': [
|
||||||
'view.xml',
|
'view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ This module adds 2 fields on the Company :
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base'],
|
'depends': ['base'],
|
||||||
'data': ['company_view.xml'],
|
'data': ['company_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,5 +39,5 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base'],
|
'depends': ['base'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ By default, you can't enter several addresses for an individual in OpenERP becau
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base'],
|
'depends': ['base'],
|
||||||
'data': ['partner_view.xml'],
|
'data': ['partner_view.xml'],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
'active': False,
|
'active': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,5 +53,5 @@ A group by 'State' is added to module search view.
|
|||||||
'module_view.xml',
|
'module_view.xml',
|
||||||
'translation_view.xml',
|
'translation_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
base_usability/static/description/icon.png
Normal file
BIN
base_usability/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
3
crm_usability/__init__.py
Normal file
3
crm_usability/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import wizard
|
||||||
35
crm_usability/__openerp__.py
Normal file
35
crm_usability/__openerp__.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (http://www.akretion.com)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'CRM Usability',
|
||||||
|
'version': '8.0.1.0.1',
|
||||||
|
'category': 'Customer Relationship Management',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'CRM usability enhancements',
|
||||||
|
'description': """
|
||||||
|
CRM Usability
|
||||||
|
=============
|
||||||
|
|
||||||
|
The usability improvements include :
|
||||||
|
|
||||||
|
* Adds multi-company record rules on crm.lead.
|
||||||
|
* Some enhancements in the *Merge Partners* wizard:
|
||||||
|
* take into account the unaccent option of the server config file
|
||||||
|
* add optional group by on 'customer' and 'supplier' (active by default)
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion
|
||||||
|
<alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['crm'],
|
||||||
|
'data': [
|
||||||
|
'crm_view.xml',
|
||||||
|
'wizard/base_partner_merge_view.xml',
|
||||||
|
'security/rule.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
37
crm_usability/crm_view.xml
Normal file
37
crm_usability/crm_view.xml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (http://www.akretion.com/)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="crm_case_form_view_oppor" model="ir.ui.view">
|
||||||
|
<field name="name">usability.crm.opportunity.form</field>
|
||||||
|
<field name="model">crm.lead</field>
|
||||||
|
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="active" position="before">
|
||||||
|
<field name="company_id" groups="base.group_multi_company"
|
||||||
|
widget="selection"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="crm_case_inbound_phone_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">crm_usability.crm.phonecall.tree.inbound</field>
|
||||||
|
<field name="model">crm.phonecall</field>
|
||||||
|
<field name="inherit_id" ref="crm.crm_case_inbound_phone_tree_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="state" position="attributes">
|
||||||
|
<attribute name="invisible">0</attribute>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
14
crm_usability/security/rule.xml
Normal file
14
crm_usability/security/rule.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
|
||||||
|
<record id="crm_lead_company_rule" model="ir.rule">
|
||||||
|
<field name="name">Lead/opportunity multi-company rule</field>
|
||||||
|
<field name="model_id" ref="crm.model_crm_lead"/>
|
||||||
|
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
BIN
crm_usability/static/description/icon.png
Normal file
BIN
crm_usability/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
3
crm_usability/wizard/__init__.py
Normal file
3
crm_usability/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import base_partner_merge
|
||||||
29
crm_usability/wizard/base_partner_merge.py
Normal file
29
crm_usability/wizard/base_partner_merge.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (http://www.akretion.com)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
|
||||||
|
from openerp import models, fields, tools
|
||||||
|
|
||||||
|
|
||||||
|
class MergePartnerAutomatic(models.TransientModel):
|
||||||
|
_inherit = 'base.partner.merge.automatic.wizard'
|
||||||
|
|
||||||
|
group_by_customer = fields.Boolean('Customer', default=True)
|
||||||
|
group_by_supplier = fields.Boolean('Supplier', default=True)
|
||||||
|
|
||||||
|
def _generate_query(self, fields, maximum_group=100):
|
||||||
|
sql = super(MergePartnerAutomatic, self)._generate_query(
|
||||||
|
fields, maximum_group=maximum_group)
|
||||||
|
name_sql_original = 'lower(name)'
|
||||||
|
if name_sql_original in sql:
|
||||||
|
if tools.config.get('unaccent', False):
|
||||||
|
sql = sql.replace(
|
||||||
|
name_sql_original,
|
||||||
|
"unaccent(lower(replace(name, ' ', '')))")
|
||||||
|
else:
|
||||||
|
sql = sql.replace(
|
||||||
|
name_sql_original,
|
||||||
|
"lower(replace(name, ' ', ''))")
|
||||||
|
|
||||||
|
return sql
|
||||||
23
crm_usability/wizard/base_partner_merge_view.xml
Normal file
23
crm_usability/wizard/base_partner_merge_view.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="base_partner_merge_automatic_wizard_form" model="ir.ui.view">
|
||||||
|
<field name="name">rvip.base.partner.merge.automatic.wizard.form</field>
|
||||||
|
<field name="model">base.partner.merge.automatic.wizard</field>
|
||||||
|
<field name="inherit_id" ref="crm.base_partner_merge_automatic_wizard_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="group_by_is_company" position="after">
|
||||||
|
<field name="group_by_customer"/>
|
||||||
|
<field name="group_by_supplier"/>
|
||||||
|
</field>
|
||||||
|
<xpath expr="//field[@name='partner_ids']/tree/field[@name='is_company']" position="after">
|
||||||
|
<field name="customer"/>
|
||||||
|
<field name="supplier"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
@@ -39,5 +39,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['delivery'],
|
'depends': ['delivery'],
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Eradicate Quick Create',
|
'name': 'Eradicate Quick Create',
|
||||||
'version': '0.1',
|
'version': '9.0.1.0.0',
|
||||||
'category': 'Tools',
|
'category': 'Tools',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Disable quick create on all objects',
|
'summary': 'Disable quick create on all objects',
|
||||||
@@ -39,4 +39,5 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['base_optional_quick_create'],
|
'depends': ['base_optional_quick_create'],
|
||||||
'data': [],
|
'data': [],
|
||||||
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,5 +34,5 @@
|
|||||||
'data': [
|
'data': [
|
||||||
'security/expense_security.xml',
|
'security/expense_security.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
hr_expense_usability/static/description/icon.png
Normal file
BIN
hr_expense_usability/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
7
hr_holidays_lunch_voucher/__init__.py
Normal file
7
hr_holidays_lunch_voucher/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import company
|
||||||
|
from . import hr_holidays
|
||||||
|
from . import hr_employee
|
||||||
|
from . import lunch_voucher_attribution
|
||||||
|
from . import wizard
|
||||||
28
hr_holidays_lunch_voucher/__openerp__.py
Normal file
28
hr_holidays_lunch_voucher/__openerp__.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'HR Holidays Lunch Voucher',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'Human Resources',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Manage lunch vouchers in holidays requests',
|
||||||
|
'description': '',
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['hr_holidays_usability', 'purchase'],
|
||||||
|
'data': [
|
||||||
|
'security/ir.model.access.csv',
|
||||||
|
'security/lunch_voucher_security.xml',
|
||||||
|
'product_data.xml',
|
||||||
|
'company_view.xml',
|
||||||
|
'wizard/lunch_voucher_purchase_view.xml',
|
||||||
|
'lunch_voucher_attribution_view.xml',
|
||||||
|
'hr_employee_view.xml',
|
||||||
|
'hr_holidays_view.xml',
|
||||||
|
'wizard/hr_holidays_post_view.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
20
hr_holidays_lunch_voucher/company.py
Normal file
20
hr_holidays_lunch_voucher/company.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields
|
||||||
|
import openerp.addons.decimal_precision as dp
|
||||||
|
|
||||||
|
|
||||||
|
class ResCompany(models.Model):
|
||||||
|
_inherit = 'res.company'
|
||||||
|
|
||||||
|
lunch_voucher_product_id = fields.Many2one(
|
||||||
|
'product.product', string='Lunch Voucher Product',
|
||||||
|
ondelete='restrict')
|
||||||
|
lunch_voucher_employer_price = fields.Float(
|
||||||
|
'Lunch Voucher Employer Price', digits=dp.get_precision('Account'))
|
||||||
|
|
||||||
|
# Add constrain to check that lunch_voucher_employer_price is between
|
||||||
|
# 50% and 60% of the price of lunch_voucher_product_id for France
|
||||||
29
hr_holidays_lunch_voucher/company_view.xml
Normal file
29
hr_holidays_lunch_voucher/company_view.xml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion France (www.akretion.com)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_company_form" model="ir.ui.view">
|
||||||
|
<field name="name">lunch_voucher.company.form</field>
|
||||||
|
<field name="model">res.company</field>
|
||||||
|
<field name="inherit_id" ref="base.view_company_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<group name="account_grp" position="after">
|
||||||
|
<group name="lunch_voucher" string="Lunch Vouchers">
|
||||||
|
<field name="lunch_voucher_product_id"/>
|
||||||
|
<!-- <field name="lunch_voucher_po_type"/> -->
|
||||||
|
<field name="lunch_voucher_employer_price"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
12
hr_holidays_lunch_voucher/hr_employee.py
Normal file
12
hr_holidays_lunch_voucher/hr_employee.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class HrEmployee(models.Model):
|
||||||
|
_inherit = 'hr.employee'
|
||||||
|
|
||||||
|
lunch_voucher = fields.Boolean(string="Has Lunch Vouchers", default=True)
|
||||||
25
hr_holidays_lunch_voucher/hr_employee_view.xml
Normal file
25
hr_holidays_lunch_voucher/hr_employee_view.xml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion France (www.akretion.com)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_employee_form_leave_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">lunch_voucher.hr.employee.form</field>
|
||||||
|
<field name="model">hr.employee</field>
|
||||||
|
<field name="inherit_id" ref="hr_holidays_usability.view_employee_form_leave_inherit"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<group name="holidays" position="inside">
|
||||||
|
<field name="lunch_voucher"/>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
45
hr_holidays_lunch_voucher/hr_holidays.py
Normal file
45
hr_holidays_lunch_voucher/hr_holidays.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
|
|
||||||
|
class HrHolidays(models.Model):
|
||||||
|
_inherit = 'hr.holidays'
|
||||||
|
|
||||||
|
lunch_voucher_id = fields.Many2one(
|
||||||
|
'lunch.voucher.attribution',
|
||||||
|
string="Related Lunch Voucher Attribution")
|
||||||
|
lunch_voucher_remove_qty = fields.Integer(
|
||||||
|
compute='_compute_lunch_voucher_remove_qty', readonly=True,
|
||||||
|
store=True, string='Lunch Vouchers to Deduct')
|
||||||
|
|
||||||
|
@api.depends('employee_id', 'vacation_date_from', 'vacation_date_to')
|
||||||
|
@api.multi
|
||||||
|
def _compute_lunch_voucher_remove_qty(self):
|
||||||
|
hhpo = self.env['hr.holidays.public']
|
||||||
|
for hol in self:
|
||||||
|
qty = 0
|
||||||
|
if (
|
||||||
|
hol.type == 'remove' and
|
||||||
|
hol.vacation_date_from and
|
||||||
|
hol.vacation_date_to):
|
||||||
|
start_date_dt = fields.Date.from_string(hol.vacation_date_from)
|
||||||
|
end_date_str = hol.vacation_date_to
|
||||||
|
date_dt = start_date_dt
|
||||||
|
# Remove 1 full LV when vacation_time_from == noon
|
||||||
|
# and also when vacation_time_to == noon
|
||||||
|
while True:
|
||||||
|
if (
|
||||||
|
date_dt.weekday() not in (5, 6) and
|
||||||
|
not hhpo.is_public_holiday(
|
||||||
|
date_dt, hol.employee_id.id)):
|
||||||
|
qty += 1
|
||||||
|
date_dt += relativedelta(days=1)
|
||||||
|
date_str = fields.Date.to_string(date_dt)
|
||||||
|
if date_str > end_date_str:
|
||||||
|
break
|
||||||
|
hol.lunch_voucher_remove_qty = qty
|
||||||
39
hr_holidays_lunch_voucher/hr_holidays_view.xml
Normal file
39
hr_holidays_lunch_voucher/hr_holidays_view.xml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (http://www.akretion.com/)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="edit_holiday_new" model="ir.ui.view">
|
||||||
|
<field name="name">hr_holidays_lunch_voucher.leave_request_form</field>
|
||||||
|
<field name="model">hr.holidays</field>
|
||||||
|
<field name="inherit_id" ref="hr_holidays_usability.edit_holiday_new"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<group name="counters" position="after">
|
||||||
|
<group name="lunch_vouchers" string="Lunch Vouchers" attrs="{'invisible': [('type', '!=', 'remove')]}">
|
||||||
|
<field name="lunch_voucher_remove_qty"/>
|
||||||
|
<field name="lunch_voucher_id"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="view_holiday" model="ir.ui.view">
|
||||||
|
<field name="name">hr_holidays_lunch_voucher.leave_request_tree</field>
|
||||||
|
<field name="model">hr.holidays</field>
|
||||||
|
<field name="inherit_id" ref="hr_holidays_usability.view_holiday"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="number_of_days" position="after">
|
||||||
|
<field name="lunch_voucher_remove_qty" string="Lunch Vouchers -=" sum="Total"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
45
hr_holidays_lunch_voucher/lunch_voucher_attribution.py
Normal file
45
hr_holidays_lunch_voucher/lunch_voucher_attribution.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class LunchVoucherAttribution(models.Model):
|
||||||
|
_name = 'lunch.voucher.attribution'
|
||||||
|
_description = 'Lunch Voucher Attribution'
|
||||||
|
_order = 'date desc'
|
||||||
|
|
||||||
|
employee_id = fields.Many2one(
|
||||||
|
'hr.employee', string='Employee', ondelete='restrict',
|
||||||
|
required=True, readonly=True)
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
related='employee_id.resource_id.company_id', readonly=True,
|
||||||
|
store=True)
|
||||||
|
date = fields.Date('Attribution Date', readonly=True)
|
||||||
|
purchase_id = fields.Many2one(
|
||||||
|
'purchase.order', 'Purchase Order',
|
||||||
|
readonly=True)
|
||||||
|
month_work_days = fields.Integer(
|
||||||
|
'Month Work Days',
|
||||||
|
help="Number of work days of the month (without taking into "
|
||||||
|
"account the holidays)")
|
||||||
|
no_lunch_days = fields.Integer(
|
||||||
|
compute='_compute_qty', string='No Lunch Days',
|
||||||
|
readonly=True, store=True)
|
||||||
|
qty = fields.Integer(
|
||||||
|
compute='_compute_qty', readonly=True, store=True,
|
||||||
|
string='Lunch Voucher Quantity')
|
||||||
|
holiday_ids = fields.One2many(
|
||||||
|
'hr.holidays', 'lunch_voucher_id', readonly=True)
|
||||||
|
|
||||||
|
@api.depends('month_work_days', 'holiday_ids.lunch_voucher_remove_qty')
|
||||||
|
@api.multi
|
||||||
|
def _compute_qty(self):
|
||||||
|
for rec in self:
|
||||||
|
no_lunch_days = 0
|
||||||
|
for hol in rec.holiday_ids:
|
||||||
|
no_lunch_days += hol.lunch_voucher_remove_qty
|
||||||
|
rec.no_lunch_days = no_lunch_days
|
||||||
|
rec.qty = rec.month_work_days - no_lunch_days
|
||||||
97
hr_holidays_lunch_voucher/lunch_voucher_attribution_view.xml
Normal file
97
hr_holidays_lunch_voucher/lunch_voucher_attribution_view.xml
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion France (www.akretion.com)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_form" model="ir.ui.view">
|
||||||
|
<field name="name">lunch.voucher.attribution.form</field>
|
||||||
|
<field name="model">lunch.voucher.attribution</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Lunch Vouchers Attribution">
|
||||||
|
<group name="main">
|
||||||
|
<field name="employee_id"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="month_work_days"/>
|
||||||
|
<field name="no_lunch_days"/>
|
||||||
|
<field name="qty"/>
|
||||||
|
<field name="purchase_id"/>
|
||||||
|
</group>
|
||||||
|
<group name="holidays" string="Related Holidays">
|
||||||
|
<field name="holiday_ids" nolabel="1" context="{'tree_view_ref': 'hr_holidays_lunch_voucher.view_holiday', 'form_view_ref': 'hr_holidays_lunch_voucher.edit_holiday_new'}"/>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_tree" model="ir.ui.view">
|
||||||
|
<field name="name">lunch.voucher.attribution.tree</field>
|
||||||
|
<field name="model">lunch.voucher.attribution</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Lunch Vouchers Attribution">
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="employee_id"/>
|
||||||
|
<field name="month_work_days"/>
|
||||||
|
<field name="no_lunch_days" sum="Total"/>
|
||||||
|
<field name="qty" sum="Total"/>
|
||||||
|
<field name="purchase_id"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_search" model="ir.ui.view">
|
||||||
|
<field name="name">lunch.voucher.attribution.search</field>
|
||||||
|
<field name="model">lunch.voucher.attribution</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Search Lunch Vouchers Attribution">
|
||||||
|
<field name="date"/>
|
||||||
|
<field name="employee_id"/>
|
||||||
|
<filter name="purchased" string="Purchased" domain="[('purchase_id', '!=', False)]"/>
|
||||||
|
<filter name="to_purchase" string="To Purchase" domain="[('purchase_id', '=', False)]"/>
|
||||||
|
<group string="Group By" name="groupby">
|
||||||
|
<filter name="employee_groupby" string="Employee" context="{'group_by': 'employee_id'}"/>
|
||||||
|
<filter name="purchase_order_groupby" string="Purchase Order" context="{'group_by': 'purchase_id'}"/>
|
||||||
|
</group>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_graph" model="ir.ui.view">
|
||||||
|
<field name="name">lunch.voucher.attribution.graph</field>
|
||||||
|
<field name="model">lunch.voucher.attribution</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<graph string="Lunch Vouchers Attribution" type="pivot">
|
||||||
|
<field name="date" type="row" interval="month"/>
|
||||||
|
<field name="qty" type="measure"/>
|
||||||
|
</graph>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Lunch Voucher Attribution</field>
|
||||||
|
<field name="res_model">lunch.voucher.attribution</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem id="lunch_voucher_attribution_menu"
|
||||||
|
action="lunch_voucher_attribution_action"
|
||||||
|
parent="hr_holidays.menu_open_ask_holidays" sequence="200"/>
|
||||||
|
|
||||||
|
<act_window id="lunch_voucher_attribution_action_create_po"
|
||||||
|
multi="True"
|
||||||
|
key2="client_action_multi"
|
||||||
|
name="Create Purchase Order"
|
||||||
|
res_model="lunch.voucher.purchase"
|
||||||
|
src_model="lunch.voucher.attribution"
|
||||||
|
view_mode="form"
|
||||||
|
target="new" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
27
hr_holidays_lunch_voucher/product_data.xml
Normal file
27
hr_holidays_lunch_voucher/product_data.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
|
||||||
|
<record id="lunch_voucher_product" model="product.product">
|
||||||
|
<field name="name">Lunch Vouchers</field>
|
||||||
|
<field name="categ_id" ref="product.product_category_all"/>
|
||||||
|
<field name="sale_ok" eval="False"/>
|
||||||
|
<field name="purchase_ok" eval="True"/>
|
||||||
|
<field name="list_price">0</field>
|
||||||
|
<field name="standard_price">8</field>
|
||||||
|
<field name="type">service</field> <!-- For those who want to manage stock of lunch vouchers, they can switch type to product manually -->
|
||||||
|
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||||
|
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||||
|
<field name="supplier_taxes_id" eval="False"/>
|
||||||
|
<field name="taxes_id" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="base.main_company" model="res.company">
|
||||||
|
<field name="lunch_voucher_product_id" ref="lunch_voucher_product"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
3
hr_holidays_lunch_voucher/security/ir.model.access.csv
Normal file
3
hr_holidays_lunch_voucher/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
|
access_lunch_voucher_attribution_full,Full access on lunch_voucher_attribution,model_lunch_voucher_attribution,base.group_hr_manager,1,1,1,1
|
||||||
|
access_lunch_voucher_attribution_read,Read access on lunch_voucher_attribution,model_lunch_voucher_attribution,base.group_user,1,0,0,0
|
||||||
|
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_employee" model="ir.rule">
|
||||||
|
<field name="name">Personal Lunch Voucher Attributions</field>
|
||||||
|
<field name="model_id" ref="hr_holidays_lunch_voucher.model_lunch_voucher_attribution"/>
|
||||||
|
<field name="domain_force">[('employee_id.user_id', '=', user.id)]</field>
|
||||||
|
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_officer" model="ir.rule">
|
||||||
|
<field name="name">HR Officer sees all Lunch Voucher Attributions</field>
|
||||||
|
<field name="model_id" ref="hr_holidays_lunch_voucher.model_lunch_voucher_attribution"/>
|
||||||
|
<field name="domain_force">[(1, '=', 1)]</field>
|
||||||
|
<field name="groups" eval="[(4, ref('base.group_hr_manager'))]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_attribution_multicompany_rule" model="ir.rule">
|
||||||
|
<field name="name">Lunch Voucher Attribution multi-company</field>
|
||||||
|
<field name="model_id" ref="hr_holidays_lunch_voucher.model_lunch_voucher_attribution"/>
|
||||||
|
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
4
hr_holidays_lunch_voucher/wizard/__init__.py
Normal file
4
hr_holidays_lunch_voucher/wizard/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import hr_holidays_post
|
||||||
|
from . import lunch_voucher_purchase
|
||||||
74
hr_holidays_lunch_voucher/wizard/hr_holidays_post.py
Normal file
74
hr_holidays_lunch_voucher/wizard/hr_holidays_post.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
from dateutil.relativedelta import relativedelta
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class HrHolidaysPost(models.TransientModel):
|
||||||
|
_inherit = 'hr.holidays.post'
|
||||||
|
|
||||||
|
lunch_voucher_po = fields.Boolean(
|
||||||
|
string='Generate Lunch Voucher Purchase Order')
|
||||||
|
work_days = fields.Integer(string='Work Days')
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def default_get(self, fields_list):
|
||||||
|
res = super(HrHolidaysPost, self).default_get(fields_list)
|
||||||
|
hhpo = self.env['hr.holidays.public']
|
||||||
|
company = self.env.user.company_id
|
||||||
|
if company.lunch_voucher_product_id:
|
||||||
|
res['lunch_voucher_po'] = True
|
||||||
|
today = fields.Date.context_today(self)
|
||||||
|
today_dt = fields.Date.from_string(today)
|
||||||
|
cur_month = today_dt.month
|
||||||
|
# last day of month
|
||||||
|
date_dt = today_dt + relativedelta(day=31)
|
||||||
|
work_days = date_dt.day
|
||||||
|
logger.info('Number of days in the month: %d', work_days)
|
||||||
|
# from last day of month to the first
|
||||||
|
while date_dt.month == cur_month:
|
||||||
|
if hhpo.is_public_holiday(date_dt):
|
||||||
|
work_days -= 1
|
||||||
|
logger.info(
|
||||||
|
"%s is a bank holiday, don't count", date_dt)
|
||||||
|
# if it's a saturday/sunday
|
||||||
|
elif date_dt.weekday() in (5, 6):
|
||||||
|
work_days -= 1
|
||||||
|
logger.info(
|
||||||
|
"%s is a saturday/sunday, don't count", date_dt)
|
||||||
|
date_dt += relativedelta(days=-1)
|
||||||
|
logger.info('Number of work days in the month: %d', work_days)
|
||||||
|
res['work_days'] = work_days
|
||||||
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def run(self):
|
||||||
|
self.ensure_one()
|
||||||
|
lvao = self.env['lunch.voucher.attribution']
|
||||||
|
today = fields.Date.context_today(self)
|
||||||
|
employees = self.env['hr.employee'].search([
|
||||||
|
('lunch_voucher', '=', True),
|
||||||
|
('company_id', '=', self.env.user.company_id.id),
|
||||||
|
])
|
||||||
|
lv_dict = {}
|
||||||
|
for employee in employees:
|
||||||
|
lv_dict[employee.id] = []
|
||||||
|
for hol in self.holidays_to_post_ids:
|
||||||
|
if not hol.lunch_voucher_id and hol.employee_id.id in lv_dict:
|
||||||
|
lv_dict[hol.employee_id.id].append(hol.id)
|
||||||
|
for employee_id, hol_ids in lv_dict.iteritems():
|
||||||
|
vals = {
|
||||||
|
'employee_id': employee_id,
|
||||||
|
'date': today,
|
||||||
|
'month_work_days': self.work_days,
|
||||||
|
}
|
||||||
|
if hol_ids:
|
||||||
|
vals['holiday_ids'] = [(6, 0, hol_ids)]
|
||||||
|
lvao.create(vals)
|
||||||
|
return super(HrHolidaysPost, self).run()
|
||||||
27
hr_holidays_lunch_voucher/wizard/hr_holidays_post_view.xml
Normal file
27
hr_holidays_lunch_voucher/wizard/hr_holidays_post_view.xml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (http://www.akretion.com/)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="hr_holidays_post_form" model="ir.ui.view">
|
||||||
|
<field name="name">hr_holidays_post_form</field>
|
||||||
|
<field name="model">hr.holidays.post</field>
|
||||||
|
<field name="inherit_id" ref="hr_holidays_usability.hr_holidays_post_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="holidays_to_post_ids" position="before">
|
||||||
|
<field name="lunch_voucher_po" states="done"/>
|
||||||
|
<field name="work_days"
|
||||||
|
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('lunch_voucher_po', '=', False)]}"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
77
hr_holidays_lunch_voucher/wizard/lunch_voucher_purchase.py
Normal file
77
hr_holidays_lunch_voucher/wizard/lunch_voucher_purchase.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, api, _
|
||||||
|
from openerp.exceptions import Warning as UserError
|
||||||
|
|
||||||
|
|
||||||
|
class LunchVoucherPurchase(models.TransientModel):
|
||||||
|
_name = 'lunch.voucher.purchase'
|
||||||
|
_description = 'Purchase Lunch Vouchers Wizard'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def run(self):
|
||||||
|
self.ensure_one()
|
||||||
|
company = self.env.user.company_id
|
||||||
|
if not company.lunch_voucher_product_id:
|
||||||
|
raise UserError(_(
|
||||||
|
"Lunch Voucher Product not configured on company %s")
|
||||||
|
% company.name)
|
||||||
|
if not company.lunch_voucher_product_id.seller_id:
|
||||||
|
raise UserError(_(
|
||||||
|
"Missing supplier on Product '%s'.")
|
||||||
|
% company.lunch_voucher_product_id.name)
|
||||||
|
|
||||||
|
poo = self.env['purchase.order']
|
||||||
|
polo = self.env['purchase.order.line']
|
||||||
|
lvao = self.env['lunch.voucher.attribution']
|
||||||
|
assert self._context.get('active_model') ==\
|
||||||
|
'lunch.voucher.attribution', 'wrong source model'
|
||||||
|
assert self._context.get('active_ids'), 'missing active_ids in ctx'
|
||||||
|
lvouchers = lvao.browse(self._context['active_ids'])
|
||||||
|
total_qty = 0
|
||||||
|
for lvoucher in lvouchers:
|
||||||
|
if lvoucher.purchase_id:
|
||||||
|
raise UserError(_(
|
||||||
|
"One of the Lunch Voucher Attributions you selected "
|
||||||
|
"related to employee '%s' is already linked to a "
|
||||||
|
"purchase order.") % lvoucher.employee_id.name)
|
||||||
|
if lvoucher.qty < 0:
|
||||||
|
raise UserError(_(
|
||||||
|
"One of the Lunch Voucher Attributions you selected "
|
||||||
|
"related to employee '%s' has a negative quantity.")
|
||||||
|
% lvoucher.employee_id.name)
|
||||||
|
total_qty += lvoucher.qty
|
||||||
|
|
||||||
|
supplier = company.lunch_voucher_product_id.seller_id
|
||||||
|
pick_type_id = poo.default_get(['picking_type_id'])['picking_type_id']
|
||||||
|
onchange_ptype_vals = poo.browse(False).onchange_picking_type_id(
|
||||||
|
pick_type_id)
|
||||||
|
vals = onchange_ptype_vals['value']
|
||||||
|
onchange_vals = poo.browse(False).onchange_partner_id(supplier.id)
|
||||||
|
vals.update(onchange_vals['value'])
|
||||||
|
vals['partner_id'] = supplier.id
|
||||||
|
|
||||||
|
product = company.lunch_voucher_product_id
|
||||||
|
onchange_product_vals = polo.browse(False).onchange_product_id(
|
||||||
|
vals.get('pricelist_id'), product.id, total_qty, False,
|
||||||
|
supplier.id, fiscal_position_id=vals.get('fiscal_position_id'))
|
||||||
|
lvals = onchange_product_vals['value']
|
||||||
|
lvals['product_id'] = product.id
|
||||||
|
lvals['product_qty'] = total_qty
|
||||||
|
if lvals['taxes_id']:
|
||||||
|
lvals['taxes_id'] = [(6, 0, lvals['taxes_id'])]
|
||||||
|
vals['order_line'] = [(0, 0, lvals)]
|
||||||
|
po = poo.create(vals)
|
||||||
|
lvouchers.write({'purchase_id': po.id})
|
||||||
|
|
||||||
|
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||||
|
'purchase', 'purchase_rfq')
|
||||||
|
action.update({
|
||||||
|
'res_id': po.id,
|
||||||
|
'view_mode': 'form,tree',
|
||||||
|
'views': False,
|
||||||
|
})
|
||||||
|
return action
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (http://www.akretion.com/)
|
||||||
|
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_purchase_form" model="ir.ui.view">
|
||||||
|
<field name="name">lunch_voucher_purchase_form</field>
|
||||||
|
<field name="model">lunch.voucher.purchase</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Create Purchase Order of Lunch Vouchers">
|
||||||
|
<group name="main">
|
||||||
|
<label string="Click on the button below to create the purchase order for the selected lunch vouchers attributions." colspan="2"/>
|
||||||
|
</group>
|
||||||
|
<footer>
|
||||||
|
<button name="run" type="object" string="Create"
|
||||||
|
class="oe_highlight"/>
|
||||||
|
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="lunch_voucher_purchase_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Create PO for Lunch Vouchers</field>
|
||||||
|
<field name="res_model">lunch.voucher.purchase</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">new</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
4
hr_holidays_lunch_voucher_natixis/__init__.py
Normal file
4
hr_holidays_lunch_voucher_natixis/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import company
|
||||||
|
from . import wizard
|
||||||
20
hr_holidays_lunch_voucher_natixis/__openerp__.py
Normal file
20
hr_holidays_lunch_voucher_natixis/__openerp__.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'HR Holidays Lunch Voucher Natixis',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'Human Resources',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Generate order file for Natixis lunch vouchers',
|
||||||
|
'description': '',
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['hr_holidays_lunch_voucher'],
|
||||||
|
'data': [
|
||||||
|
'company_view.xml',
|
||||||
|
],
|
||||||
|
'installable': False,
|
||||||
|
}
|
||||||
15
hr_holidays_lunch_voucher_natixis/company.py
Normal file
15
hr_holidays_lunch_voucher_natixis/company.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class ResCompany(models.Model):
|
||||||
|
_inherit = 'res.company'
|
||||||
|
|
||||||
|
lunch_voucher_natixis_customer_code = fields.Char(
|
||||||
|
string='Natixis Customer Ref', size=7)
|
||||||
|
lunch_voucher_natixis_delivery_code = fields.Char(
|
||||||
|
string='Natixis Delivery Code', size=7)
|
||||||
26
hr_holidays_lunch_voucher_natixis/company_view.xml
Normal file
26
hr_holidays_lunch_voucher_natixis/company_view.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion France (www.akretion.com)
|
||||||
|
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_company_form" model="ir.ui.view">
|
||||||
|
<field name="name">natixis.lunch_voucher.company.form</field>
|
||||||
|
<field name="model">res.company</field>
|
||||||
|
<field name="inherit_id" ref="hr_holidays_lunch_voucher.view_company_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<group name="lunch_voucher" position="inside">
|
||||||
|
<field name="lunch_voucher_natixis_customer_code"/>
|
||||||
|
<field name="lunch_voucher_natixis_delivery_code"/>
|
||||||
|
</group>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
3
hr_holidays_lunch_voucher_natixis/wizard/__init__.py
Normal file
3
hr_holidays_lunch_voucher_natixis/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import lunch_voucher_purchase
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import models, fields, api, _
|
||||||
|
from openerp.exceptions import Warning as UserError
|
||||||
|
|
||||||
|
|
||||||
|
class LunchVoucherPurchase(models.TransientModel):
|
||||||
|
_inherit = 'lunch.voucher.purchase'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def run(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = super(LunchVoucherPurchase, self).run()
|
||||||
|
company = self.env.user.company_id
|
||||||
|
lvao = self.env['lunch.voucher.attribution']
|
||||||
|
assert self._context.get('active_model')\
|
||||||
|
== 'lunch.voucher.attribution', 'wrong source model'
|
||||||
|
assert self._context.get('active_ids'), 'missing active_ids in ctx'
|
||||||
|
if not company.lunch_voucher_natixis_customer_code:
|
||||||
|
raise UserError(_(
|
||||||
|
"Missing Natixis Customer Ref on company '%s'.")
|
||||||
|
% company.name)
|
||||||
|
if not company.lunch_voucher_natixis_delivery_code:
|
||||||
|
raise UserError(_(
|
||||||
|
"Missing Natixis Delivery Code on company '%s'.")
|
||||||
|
% company.name)
|
||||||
|
if len(company.lunch_voucher_natixis_customer_code) != 7:
|
||||||
|
raise UserError(_(
|
||||||
|
"Natixis Customer Ref '%s' on company '%s' should "
|
||||||
|
"have 7 characters/digits.")
|
||||||
|
% (company.lunch_voucher_natixis_customer_code, company.name))
|
||||||
|
if len(company.lunch_voucher_natixis_delivery_code) != 7:
|
||||||
|
raise UserError(_(
|
||||||
|
"Natixis Delivery Code on company '%s' should "
|
||||||
|
"have 7 characters/digits.")
|
||||||
|
% (company.lunch_voucher_natixis_delivery_code, company.name))
|
||||||
|
if not company.lunch_voucher_employer_price:
|
||||||
|
raise UserError(_(
|
||||||
|
"Lunch Voucher Employer Price not set on company '%s'.")
|
||||||
|
% company.name)
|
||||||
|
lvouchers = lvao.browse(self._context['active_ids'])
|
||||||
|
of = u''
|
||||||
|
tmp = {}
|
||||||
|
for lvoucher in lvouchers:
|
||||||
|
if lvoucher.qty > 0:
|
||||||
|
if lvoucher.qty not in tmp:
|
||||||
|
tmp[lvoucher.qty] = 1
|
||||||
|
else:
|
||||||
|
tmp[lvoucher.qty] += 1
|
||||||
|
for vouchers_per_pack, pack_qty in tmp.iteritems():
|
||||||
|
if vouchers_per_pack > 99:
|
||||||
|
raise UserError(_(
|
||||||
|
"Cannot order more than 99 vouchers per pack"))
|
||||||
|
line = u'%s%s%s%s%s%s%s%s\n' % (
|
||||||
|
company.lunch_voucher_natixis_delivery_code,
|
||||||
|
company.lunch_voucher_natixis_customer_code,
|
||||||
|
unicode(pack_qty).zfill(3),
|
||||||
|
unicode(vouchers_per_pack).zfill(2),
|
||||||
|
unicode(pack_qty * vouchers_per_pack).zfill(5),
|
||||||
|
'{:05.2f}'.format(
|
||||||
|
company.lunch_voucher_product_id.standard_price),
|
||||||
|
'{:05.2f}'.format(company.lunch_voucher_employer_price),
|
||||||
|
' ' * 64)
|
||||||
|
of += line
|
||||||
|
today_dt = fields.Date.from_string(
|
||||||
|
fields.Date.context_today(self))
|
||||||
|
filename = 'E%s_%s.txt' % (
|
||||||
|
company.lunch_voucher_natixis_customer_code,
|
||||||
|
today_dt.strftime('%d%m%Y'))
|
||||||
|
self.env['ir.attachment'].create({
|
||||||
|
'name': filename,
|
||||||
|
'res_id': action['res_id'],
|
||||||
|
'res_model': 'purchase.order',
|
||||||
|
'datas': of.encode('base64'),
|
||||||
|
'datas_fname': filename,
|
||||||
|
'type': 'binary',
|
||||||
|
})
|
||||||
|
return action
|
||||||
@@ -42,5 +42,5 @@
|
|||||||
'security/holiday_security.xml',
|
'security/holiday_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,6 +184,9 @@ class HrHolidays(models.Model):
|
|||||||
|
|
||||||
vacation_date_from = fields.Date(
|
vacation_date_from = fields.Date(
|
||||||
string='First Day of Vacation', track_visibility='onchange',
|
string='First Day of Vacation', track_visibility='onchange',
|
||||||
|
readonly=True, states={
|
||||||
|
'draft': [('readonly', False)],
|
||||||
|
'confirm': [('readonly', False)]},
|
||||||
help="Enter the first day of vacation. For example, if "
|
help="Enter the first day of vacation. For example, if "
|
||||||
"you leave one full calendar week, the first day of vacation "
|
"you leave one full calendar week, the first day of vacation "
|
||||||
"is Monday morning (and not Friday of the week before)")
|
"is Monday morning (and not Friday of the week before)")
|
||||||
@@ -191,11 +194,16 @@ class HrHolidays(models.Model):
|
|||||||
('morning', 'Morning'),
|
('morning', 'Morning'),
|
||||||
('noon', 'Noon'),
|
('noon', 'Noon'),
|
||||||
], string="Start of Vacation", track_visibility='onchange',
|
], string="Start of Vacation", track_visibility='onchange',
|
||||||
default='morning',
|
default='morning', readonly=True, states={
|
||||||
|
'draft': [('readonly', False)],
|
||||||
|
'confirm': [('readonly', False)]},
|
||||||
help="For example, if you leave one full calendar week, "
|
help="For example, if you leave one full calendar week, "
|
||||||
"the first day of vacation is Monday Morning")
|
"the first day of vacation is Monday Morning")
|
||||||
vacation_date_to = fields.Date(
|
vacation_date_to = fields.Date(
|
||||||
string='Last Day of Vacation', track_visibility='onchange',
|
string='Last Day of Vacation', track_visibility='onchange',
|
||||||
|
readonly=True, states={
|
||||||
|
'draft': [('readonly', False)],
|
||||||
|
'confirm': [('readonly', False)]},
|
||||||
help="Enter the last day of vacation. For example, if you "
|
help="Enter the last day of vacation. For example, if you "
|
||||||
"leave one full calendar week, the last day of vacation is "
|
"leave one full calendar week, the last day of vacation is "
|
||||||
"Friday evening (and not Monday of the week after)")
|
"Friday evening (and not Monday of the week after)")
|
||||||
@@ -203,7 +211,9 @@ class HrHolidays(models.Model):
|
|||||||
('noon', 'Noon'),
|
('noon', 'Noon'),
|
||||||
('evening', 'Evening'),
|
('evening', 'Evening'),
|
||||||
], string="End of Vacation", track_visibility='onchange',
|
], string="End of Vacation", track_visibility='onchange',
|
||||||
default='evening',
|
default='evening', readonly=True, states={
|
||||||
|
'draft': [('readonly', False)],
|
||||||
|
'confirm': [('readonly', False)]},
|
||||||
help="For example, if you leave one full calendar week, "
|
help="For example, if you leave one full calendar week, "
|
||||||
"the end of vacation is Friday Evening")
|
"the end of vacation is Friday Evening")
|
||||||
current_leaves_taken = fields.Float(
|
current_leaves_taken = fields.Float(
|
||||||
@@ -228,8 +238,13 @@ class HrHolidays(models.Model):
|
|||||||
# The 'name' field is displayed publicly in the calendar
|
# The 'name' field is displayed publicly in the calendar
|
||||||
# So the label should not be 'Description' but 'Public Title'
|
# So the label should not be 'Description' but 'Public Title'
|
||||||
name = fields.Char(
|
name = fields.Char(
|
||||||
string='Public Title', help="Warning: this title is shown publicly in the "
|
string='Public Title',
|
||||||
|
help="Warning: this title is shown publicly in the "
|
||||||
"calendar. Don't write private/personnal information in this field.")
|
"calendar. Don't write private/personnal information in this field.")
|
||||||
|
# by default, there is no company_id field on hr.holidays !
|
||||||
|
company_id = fields.Many2one(
|
||||||
|
related='employee_id.resource_id.company_id', store=True,
|
||||||
|
readonly=True)
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
@api.constrains(
|
@api.constrains(
|
||||||
@@ -381,6 +396,19 @@ class HrHolidays(models.Model):
|
|||||||
res = super(HrHolidays, self).holidays_validate()
|
res = super(HrHolidays, self).holidays_validate()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def holidays_refuse(self):
|
||||||
|
for holi in self:
|
||||||
|
if (
|
||||||
|
holi.user_id == self.env.user and
|
||||||
|
not self.pool['res.users'].has_group(
|
||||||
|
self._cr, self._uid, 'base.group_hr_manager')):
|
||||||
|
raise UserError(_(
|
||||||
|
"You cannot refuse your own Leave or Allocation "
|
||||||
|
"holiday request '%s'.")
|
||||||
|
% holi.name)
|
||||||
|
return super(HrHolidays, self).holidays_refuse()
|
||||||
|
|
||||||
|
|
||||||
class ResCompany(models.Model):
|
class ResCompany(models.Model):
|
||||||
_inherit = 'res.company'
|
_inherit = 'res.company'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data noupdate="0">
|
||||||
|
|
||||||
<record id="ir_actions_server_hr_holidays_confirm_mail" model="ir.actions.server">
|
<record id="ir_actions_server_hr_holidays_confirm_mail" model="ir.actions.server">
|
||||||
<field name="name">Auto-email confirmed leave</field>
|
<field name="name">Auto-email confirmed leave</field>
|
||||||
@@ -59,6 +59,9 @@ if not object.no_email_notification:
|
|||||||
<field name="action_id" ref="ir_actions_server_hr_holidays_refuse_mail"/>
|
<field name="action_id" ref="ir_actions_server_hr_holidays_refuse_mail"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
<record id="email_template_hr_holidays" model="email.template">
|
<record id="email_template_hr_holidays" model="email.template">
|
||||||
<field name="name">Holidays email template</field>
|
<field name="name">Holidays email template</field>
|
||||||
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
|
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ hr_holidays.edit_holiday_new is used for both leaves and allocation -->
|
|||||||
</group>
|
</group>
|
||||||
</field>
|
</field>
|
||||||
<field name="department_id" position="after">
|
<field name="department_id" position="after">
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="posted_date" groups="base.group_hr_manager"/>
|
<field name="posted_date" groups="base.group_hr_manager"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
@@ -90,6 +91,7 @@ hr_holidays.edit_holiday_new is used for both leaves and allocation -->
|
|||||||
</field>
|
</field>
|
||||||
<field name="holiday_status_id" position="after">
|
<field name="holiday_status_id" position="after">
|
||||||
<field name="posted_date" groups="base.group_hr_manager"/>
|
<field name="posted_date" groups="base.group_hr_manager"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<openerp>
|
||||||
<data noupdate="0">
|
<data noupdate="1">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Employee : only see his holidays
|
Employee : only see his holidays
|
||||||
@@ -41,5 +41,12 @@ Manager = person that administrates the holidays process : can see everything, d
|
|||||||
<field name="groups" eval="[(4, ref('base.group_hr_manager'))]"/>
|
<field name="groups" eval="[(4, ref('base.group_hr_manager'))]"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_holidays_multicompany_rule" model="ir.rule">
|
||||||
|
<field name="name">Holidays multi-company</field>
|
||||||
|
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
|
||||||
|
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ class HrHolidaysMassAllocation(models.TransientModel):
|
|||||||
@api.model
|
@api.model
|
||||||
def _default_employees(self):
|
def _default_employees(self):
|
||||||
return self.env['hr.employee'].search([
|
return self.env['hr.employee'].search([
|
||||||
('holiday_exclude_mass_allocation', '=', False)])
|
('holiday_exclude_mass_allocation', '=', False),
|
||||||
|
('company_id', '=', self.env.user.company_id.id),
|
||||||
|
])
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_default_holiday_status(self):
|
def _get_default_holiday_status(self):
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class HrHolidaysPost(models.TransientModel):
|
|||||||
('state', '=', 'validate'),
|
('state', '=', 'validate'),
|
||||||
('posted_date', '=', False),
|
('posted_date', '=', False),
|
||||||
('vacation_date_to', '<=', self.before_date),
|
('vacation_date_to', '<=', self.before_date),
|
||||||
|
('company_id', '=', self.env.user.company_id.id),
|
||||||
])
|
])
|
||||||
self.write({
|
self.write({
|
||||||
'state': 'done',
|
'state': 'done',
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
<field name="name">hr_holidays_post_form</field>
|
<field name="name">hr_holidays_post_form</field>
|
||||||
<field name="model">hr.holidays.post</field>
|
<field name="model">hr.holidays.post</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Post Leaves" version="7.0">
|
<form string="Post Leaves">
|
||||||
<group name="main" string="Leave Requests to Post">
|
<group name="main" string="Leave Requests to Post">
|
||||||
<field name="state" invisible="1"/>
|
<field name="state" invisible="1"/>
|
||||||
<field name="before_date" states="draft"/>
|
<field name="before_date" states="draft"/>
|
||||||
<field name="holidays_to_post_ids" nolabel="1"
|
<field name="holidays_to_post_ids" nolabel="1"
|
||||||
context="{'tree_view_ref': 'hr_holidays.view_holiday'}"
|
context="{'tree_view_ref': 'hr_holidays.view_holiday'}"
|
||||||
states="done"/>
|
states="done" colspan="2"/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="select_date" type="object" string="Get Holiday Requests"
|
<button name="select_date" type="object" string="Get Holiday Requests"
|
||||||
|
|||||||
@@ -1,23 +1,3 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# HR Usability module for Odoo
|
|
||||||
# Copyright (C) 2015 Akretion (http://www.akretion.com)
|
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
|
|
||||||
|
from . import hr
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ This module has been developped by Alexis de Lattre <alexis.delattre@akretion.co
|
|||||||
'data': [
|
'data': [
|
||||||
'hr_view.xml',
|
'hr_view.xml',
|
||||||
],
|
],
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
46
hr_usability/hr.py
Normal file
46
hr_usability/hr.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# HR Usability module for Odoo
|
||||||
|
# Copyright (C) 2016 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class HrEmployee(models.Model):
|
||||||
|
_inherit = 'hr.employee'
|
||||||
|
|
||||||
|
country_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
birthday = fields.Date(track_visibility='onchange')
|
||||||
|
ssnid = fields.Char(track_visibility='onchange')
|
||||||
|
sinid = fields.Char(track_visibility='onchange')
|
||||||
|
identification_id = fields.Char(track_visibility='onchange')
|
||||||
|
otherid = fields.Char(track_visibility='onchange')
|
||||||
|
gender = fields.Selection(track_visibility='onchange')
|
||||||
|
marital = fields.Selection(track_visibility='onchange')
|
||||||
|
department_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
address_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
address_home_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
work_phone = fields.Char(track_visibility='onchange')
|
||||||
|
mobile_phone = fields.Char(track_visibility='onchange')
|
||||||
|
work_email = fields.Char(track_visibility='onchange')
|
||||||
|
parent_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
coach_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
job_id = fields.Many2one(track_visibility='onchange')
|
||||||
|
passport_id = fields.Char(track_visibility='onchange')
|
||||||
@@ -42,5 +42,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'depends': ['intrastat_product', 'l10n_fr_intrastat_service'],
|
'depends': ['intrastat_product', 'l10n_fr_intrastat_service'],
|
||||||
'data': ['product_view.xml'],
|
'data': ['product_view.xml'],
|
||||||
'post_init_hook': 'set_intrastat_type_on_products',
|
'post_init_hook': 'set_intrastat_type_on_products',
|
||||||
'installable': True,
|
'installable': False,
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user