Skip to content

Commit

Permalink
Rates required
Browse files Browse the repository at this point in the history
Disabled delete from tree view of wt statements and wt moves

Rates required

Disabled delete from tree view of wt statements and wt moves

Fix conflicts and changed code with new standards
  • Loading branch information
alessandrocamilli authored and TonyMasciI committed Jan 16, 2023
1 parent 40b1a67 commit 2e5cce9
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 42 deletions.
30 changes: 20 additions & 10 deletions l10n_it_withholding_tax/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-15 10:49+0000\n"
"PO-Revision-Date: 2016-12-15 10:49+0000\n"
"POT-Creation-Date: 2017-07-24 16:27+0000\n"
"PO-Revision-Date: 2017-07-24 16:27+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -55,7 +55,7 @@ msgstr "Importo"
#: model:ir.model.fields,field_description:l10n_it_withholding_tax.field_withholding_tax_statement_base
#. module: l10n_it_withholding_tax
msgid "Base"
msgstr "Imponibile"
msgstr "Base"

#: model:ir.model.fields,field_description:l10n_it_withholding_tax.field_account_invoice_withholding_tax_base_coeff
#. module: l10n_it_withholding_tax
Expand Down Expand Up @@ -149,7 +149,13 @@ msgstr "Nome Visualizzato"
msgid "Due"
msgstr "Da pagare"

#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:117
#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:55
#. module: l10n_it_withholding_tax
#, python-format
msgid "Error! Rates are required"
msgstr "Errore! Inserire almeno uno scaglione di validità per le aliquote"

#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:124
#. module: l10n_it_withholding_tax
#, python-format
msgid "Error! You cannot have 2 pricelist versions that overlap!"
Expand Down Expand Up @@ -319,7 +325,7 @@ msgstr "Stato"
#: model:ir.model.fields,field_description:l10n_it_withholding_tax.field_withholding_tax_statement_tax
#. module: l10n_it_withholding_tax
msgid "Tax"
msgstr "Ritenuta Dovuta"
msgstr "Imposta"

#: model:ir.model.fields,field_description:l10n_it_withholding_tax.field_withholding_tax_rate_tax
#: model:ir.model.fields,field_description:l10n_it_withholding_tax.field_withholding_tax_tax
Expand Down Expand Up @@ -368,8 +374,13 @@ msgstr "Used from trace WT from other parts"
msgid "W.T."
msgstr "R.A."

#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:236
#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:246
#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:250
#. module: l10n_it_withholding_tax
#, python-format
msgid "WT %s - %s"
msgstr "WT %s - %s"

#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:260
#. module: l10n_it_withholding_tax
#, python-format
msgid "WT %s - %s - %s"
Expand Down Expand Up @@ -405,14 +416,13 @@ msgstr "Ritenuta Versata"
msgid "WT moves"
msgstr "Voci Ritenuta"

#: code:addons/l10n_it_withholding_tax/models/account.py:124
#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:332
#: code:addons/l10n_it_withholding_tax/models/account.py:121
#. module: l10n_it_withholding_tax
#, python-format
msgid "Warning! Only Withholding Tax moves in Due status can be deleted"
msgstr "Attenzione! Solo Voci di ritenuta \"Da pagare\" possono essere cancellate"

#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:232
#: code:addons/l10n_it_withholding_tax/models/withholding_tax.py:246
#. module: l10n_it_withholding_tax
#, python-format
msgid "Warning! Wt account move already exists: %s"
Expand Down
6 changes: 3 additions & 3 deletions l10n_it_withholding_tax/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from openerp import models, fields, api, _
import openerp.addons.decimal_precision as dp
from openerp.exceptions import ValidationError
from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import ValidationError


class AccountPartialReconcile(models.Model):
Expand Down
13 changes: 10 additions & 3 deletions l10n_it_withholding_tax/models/withholding_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
from openerp import netsvc
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from odoo import netsvc


class WithholdingTax(models.Model):
Expand Down Expand Up @@ -47,6 +47,13 @@ def _get_rate(self):
rate_ids = fields.One2many('withholding.tax.rate', 'withholding_tax_id',
'Rates', required=True)

@api.one
@api.constrains('rate_ids')
def _check_rate_ids(self):
if not self.rate_ids:
raise ValidationError(
_('Error! Rates are required'))

def compute_tax(self, amount):
res = {
'base': 0,
Expand Down
7 changes: 2 additions & 5 deletions l10n_it_withholding_tax/views/account.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<odoo>
<!--
INVOICE CUSTOMER
-->
Expand Down Expand Up @@ -153,5 +151,4 @@
</field>
</record>

</data>
</openerp>
</odoo>
18 changes: 8 additions & 10 deletions l10n_it_withholding_tax/views/withholding_tax.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>

<menuitem id="wt_main" name="Withholding tax" parent="account.menu_finance" sequence="5" />

Expand All @@ -11,7 +10,7 @@
<field name="name">view.withholding.tax.tree</field>
<field name="model">withholding.tax</field>
<field name="arch" type="xml">
<tree string="Withholding Tax" version="7.0">
<tree string="Withholding Tax">
<field name="name"/>
<field name="code"/>
<field name="tax"/>
Expand All @@ -27,7 +26,7 @@
<field name="name">view.withholding.tax.form</field>
<field name="model">withholding.tax</field>
<field name="arch" type="xml">
<form string="Withholding Tax" version="7.0">
<form string="Withholding Tax">
<group>
<group>
<field name="name"/>
Expand Down Expand Up @@ -89,7 +88,7 @@
<field name="name">view.withholding.tax.statement.tree</field>
<field name="model">withholding.tax.statement</field>
<field name="arch" type="xml">
<tree string="Withholding Tax statement" version="7.0">
<tree string="Withholding Tax statement" delete="false">
<field name="partner_id"/>
<field name="date"/>
<field name="move_id"/>
Expand All @@ -108,7 +107,7 @@
<field name="model">withholding.tax.statement</field>
<field name="arch" type="xml">

<form string="Withholding Tax statement" version="7.0">
<form string="Withholding Tax statement">
<sheet>
<group>
<group>
Expand Down Expand Up @@ -177,7 +176,7 @@
<field name="name">view.withholding.tax.move.tree</field>
<field name="model">withholding.tax.move</field>
<field name="arch" type="xml">
<tree string="Withholding Tax Move" version="7.0">
<tree string="Withholding Tax Move" delete="false">
<field name="partner_id"/>
<field name="date"/>
<field name="withholding_tax_id"/>
Expand All @@ -193,7 +192,7 @@
<field name="name">view.withholding.tax.move.form</field>
<field name="model">withholding.tax.move</field>
<field name="arch" type="xml">
<form string="Withholding Tax Move" version="7.0">
<form string="Withholding Tax Move">
<header>
<button name="action_set_to_draft" states="paid" string="Set to Draft" type="object" />
<button name="action_paid" states="due" string="Paid" type="object" />
Expand Down Expand Up @@ -253,5 +252,4 @@
<menuitem id="menu_withholding_tax_move" name="WT Moves"
action="action_withholding_tax_move" parent="wt_main" sequence="10"/>

</data>
</openerp>
</odoo>
20 changes: 9 additions & 11 deletions l10n_it_withholding_tax/workflow.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>

<!-- WT move -->
<!-- Workflow definition -->

Expand All @@ -9,8 +9,8 @@
<field name="osv">withholding.tax.move</field>
<field name="on_create">True</field>
</record>


<record id="act_due" model="workflow.activity">
<field name="wkf_id" ref="wkf_wt_move"/>
<field name="name">draft</field>
Expand All @@ -20,7 +20,7 @@
</field>
<field name="flow_start">True</field>
</record>

<record id="act_paid" model="workflow.activity">
<field name="wkf_id" ref="wkf_wt_move"/>
<field name="name">paid</field>
Expand All @@ -29,22 +29,20 @@
move_paid()
</field>
</record>



<!-- transitions -->
<record id="rec_move_t1" model="workflow.transition">
<field name="act_from" ref="act_due"/>
<field name="act_to" ref="act_paid"/>
<field name="signal">paid</field>
<field name="group_id" ref="base.group_user"/>
</record>

<record id="rec_move_t3" model="workflow.transition">
<field name="act_from" ref="act_paid"/>
<field name="act_to" ref="act_due"/>
<field name="signal">cancel</field>
<!--<field name="group_id" ref="group_relate_manager"/>-->
</record>
</data>

</openerp>

</odoo>

0 comments on commit 2e5cce9

Please sign in to comment.