Merge pull request #487 from acsone/10.0-account_move_line_tax_editable-bwi

[10.0][ADD] Module to allow account move line taxes edition
This commit is contained in:
Stéphane Bidoul (ACSONE)
2017-05-29 18:09:43 +02:00
committed by GitHub
12 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==============================
Account Move Line Tax Editable
==============================
Allows to edit taxes on account move lines
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Thomas Binsfeld <thomas.binsfeld@acsone.eu>
* Benjamin Willig <benjamin.willig@acsone.eu>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Account Move Line Tax Editable',
'summary': """
Allows to edit taxes on non-posted account move lines""",
'version': '10.0.1.0.0',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV,Odoo Community Association (OCA)',
'website': 'https://www.acsone.eu',
'depends': [
'account',
],
'data': [
'views/account_move.xml',
'views/account_move_line.xml',
],
'demo': [
],
}

View File

@@ -0,0 +1 @@
from . import account_move_line

View File

@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
is_tax_editable = fields.Boolean(
string="Is tax data editable?", compute='_compute_is_tax_editable')
@api.multi
@api.depends('move_id.state')
def _compute_is_tax_editable(self):
for rec in self:
rec.is_tax_editable = rec._get_is_tax_editable()
@api.multi
def _get_is_tax_editable(self):
self.ensure_one()
return self.move_id.state == 'draft'

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record model="ir.ui.view" id="account_move_form_view">
<field name="name">account.move.form (in account_move_line_tax_editable)</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']/tree/field[@name='name']" position="after">
<field name="is_tax_editable" invisible="1"/>
<field name="tax_line_id" attrs="{'readonly': [('is_tax_editable', '=', False)]}"/>
<field name="tax_ids" attrs="{'readonly': [('is_tax_editable', '=', False)]}"
widget="many2many_tags"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<data>
<record model="ir.ui.view" id="account_move_line_form_view">
<field name="name">account.move.line.form (in account_move_line_tax_editable)</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="tax_line_id" position="before">
<field name="is_tax_editable" invisible="1"/>
</field>
<field name="tax_line_id" position="attributes">
<attribute name="readonly">0</attribute>
<attribute name="attrs">{'readonly': [('is_tax_editable', '=', False)]}</attribute>
</field>
<field name="tax_ids" position="attributes">
<attribute name="readonly">0</attribute>
<attribute name="attrs">{'readonly': [('is_tax_editable', '=', False)]}</attribute>
</field>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
../../../../account_move_line_tax_editable

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)