Skip to content

Commit

Permalink
Fixed customs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rosenvladimirov committed May 4, 2024
1 parent 7ab94dc commit 57f6108
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
13 changes: 11 additions & 2 deletions l10n_bg_config/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@
name="account_bg_vat">
<field name="l10n_bg_narration"/>
<field name="l10n_bg_type_vat"/>
<field name="l10n_bg_doc_type" attrs="{'invisible': [('move_type', '=', 'entry')]}"/>
<field name="l10n_bg_name" attrs="{'invisible': [('l10n_bg_type_vat', '=', 'standard')]}"/>
<field name="l10n_bg_doc_type"/>
<field name="l10n_bg_name" attrs="{'invisible': [('l10n_bg_type_vat', 'in', ['standard', 'in_customs'])]}"/>
<field name="l10n_bg_delivery_type"/>
</group>
</xpath>
<xpath expr="//page[@id='other_tab_entry']/group[@id='other_tab_entry_group']" position="inside">
<group string="Bulgarian VAT" name="account_bg_vat_entry" attrs="{'invisible': [('l10n_bg_type_vat', '=', 'standard')]}">
<field name="l10n_bg_narration"/>
<field name="l10n_bg_type_vat"/>
<field name="l10n_bg_doc_type"/>
<field name="l10n_bg_name"/>
<field name="l10n_bg_delivery_type"/>
</group>
</xpath>
Expand Down
8 changes: 4 additions & 4 deletions l10n_bg_tax_admin/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,20 @@ class AccountMove(models.Model):
# CUSTOMS FIELDS
# --------------

l10n_bg_customs_date = fields.Char("Customs date", copy=False)
l10n_bg_customs_date = fields.Date("Customs date", copy=False)
l10n_bg_customs_invoice_id = fields.Many2one('account.move',
string='Base invoice',
check_company=True,
copy=False,
readonly=True,
states={'draft': [('readonly', True)]},
)
l10n_bg_customs_id = fields.Many2one(
'account.move.bg.customs',
'Customs',
states = {'draft': [('readonly', True)]},
)
l10n_bg_customs_date_custom_id = fields.Char("Customs date", related='l10n_bg_customs_id.l10n_bg_customs_date')
l10n_bg_name_custom_id = fields.Char("Customs number", related='l10n_bg_customs_id.l10n_bg_name')
l10n_bg_customs_date_custom_id = fields.Date("Customs date", related='l10n_bg_customs_invoice_id.l10n_bg_customs_date')
l10n_bg_name_custom_id = fields.Char("Customs number", related='l10n_bg_customs_invoice_id.l10n_bg_name')

# === Partner fields === #
l10n_bg_customs_partner_id = fields.Many2one('res.partner',
Expand Down Expand Up @@ -140,6 +139,7 @@ def _get_move_display_name(self, show_ref=False):
def _new_entry_vals(self, fiscal_position_id):
return {
'move_type': 'entry',
'date': self.date,
'fiscal_position_id': fiscal_position_id.id,
'line_ids': [Command.clear()],
'invoice_line_ids': [Command.clear()],
Expand Down
25 changes: 9 additions & 16 deletions l10n_bg_tax_admin/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@
type='object' groups="account.group_account_invoice"
context="{'search_default_l10n_bg_customs_invoice_id': [active_id]}"
data-hotkey='r'
attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'in_customs')]}"/>
<button name="view_account_custom" string='Invoice'
type='object' groups="account.group_account_invoice"
context="{'search_default_l10n_bg_customs_invoice_id': [active_id]}"
data-hotkey='r'
attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'in_customs'), ('l10n_bg_customs_invoice_id', '=', False)]}"/>
attrs="{'invisible': [('l10n_bg_customs_invoice_id', '=', False)]}"/>

</xpath>
<xpath expr="//field[@name='quick_encoding_vals']" position="after">
Expand All @@ -35,24 +30,19 @@
<page id="customs_tab" name="customs_tab" string="Customs invoices" attrs="{'invisible': [('l10n_bg_customs_invoice_id', '=', False)]}">
<group>
<group>
<field name="partner_id" options="{'no_create': True}"/>
<field name="l10n_bg_customs_partner_id" options="{'no_create': True}"/>
<field name="l10n_bg_customs_partner_shipping_id" options="{'no_create': True}"/>
</group>
<group>
<field name="l10n_bg_customs_date"/>
<field name="l10n_bg_name" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'standard'), ('move_type', '!=', 'entry')]}"/>
<field name="l10n_bg_customs_date" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'in_customs')]}"/>
<field name="l10n_bg_customs_date_custom_id" readonly="0" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'standard')]}"/>
<field name="l10n_bg_name" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'in_customs')]}"/>
<field name="l10n_bg_name_custom_id" readonly="0" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'standard')]}"/>
</group>
</group>
</page>
</xpath>
<xpath expr="//page[@id='other_tab']/group[@id='other_tab_group']" position="inside">
<group string="Bulgarian VAT"
name="account_bg_vat">
<field name="l10n_bg_currency_rate" attrs="{'invisible': [('l10n_bg_type_vat', 'not in', ['in_customs', 'out_customs'])]}"/>
<field name="l10n_bg_doc_type" attrs="{'invisible': [('move_type', '=', 'entry')]}"/>
<field name="l10n_bg_name" attrs="{'invisible': [('l10n_bg_type_vat', '=', 'standard')]}"/>
</group>
</xpath>
</field>
</record>
<record id="view_move_form_attributes" model="ir.ui.view">
Expand All @@ -64,6 +54,9 @@
<attribute name="readonly">1</attribute>
<attribute name="force_save">1</attribute>
</field>
<xpath expr="//group[@name='account_bg_vat']" position="inside">
<field name="l10n_bg_currency_rate" attrs="{'invisible': [('l10n_bg_type_vat', '!=', 'standard')]}"/>
</xpath>
</field>
</record>
</odoo>

0 comments on commit 57f6108

Please sign in to comment.