-
-
Notifications
You must be signed in to change notification settings - Fork 863
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] partner_vat_unique: add configuration parameter for unique VAT …
…constraint - Defined `partner_vat_unique` as a boolean configuration parameter. - Updated `res.partner` to validate VAT uniqueness based on this parameter. - Added a new section in ResConfigSettings for enabling/disabling the constraint. - Updated tests to include scenarios with the configuration parameter.
- Loading branch information
Showing
6 changed files
with
47 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from . import res_partner | ||
from . import res_config_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields | ||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
partner_vat_unique = fields.Boolean( | ||
string="Unique VAT Constraint", | ||
config_parameter="partner_vat_unique.partner_vat_unique", | ||
help="Check this if you want to constrain VAT number to be unique." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<odoo> | ||
<record id="res_config_settings_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.partner.vat.unique</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form" /> | ||
<field name="arch" type="xml"> | ||
<block name="contacts_setting_container" position="inside"> | ||
<setting help="Check this if you want to constrain VAT number to be unique"> | ||
<field name="partner_vat_unique"/> | ||
</setting> | ||
</block> | ||
</field> | ||
</record> | ||
</odoo> |