Skip to content

Commit

Permalink
Validação do tipo da posição fiscal na criação da fatura.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioluna committed Aug 18, 2017
1 parent ca7f37e commit 90de80a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
5 changes: 3 additions & 2 deletions br_account/models/account_fiscal_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class AccountFiscalPositionTaxRule(models.Model):
string=u"ICMS Intra", domain=[('domain', '=', 'icms_intra')])
tax_icms_fcp_id = fields.Many2one(
'account.tax', string=u"% FCP", domain=[('domain', '=', 'fcp')])
fiscal_type = fields.Selection([('saida', 'Saída'),
('entrada', 'Entrada')])


class AccountFiscalPosition(models.Model):
Expand Down Expand Up @@ -117,6 +115,9 @@ class AccountFiscalPosition(models.Model):
inss_tax_rule_ids = fields.One2many(
'account.fiscal.position.tax.rule', 'fiscal_position_id',
string=u"Regras INSS", domain=[('domain', '=', 'inss')])
fiscal_type = fields.Selection([('saida', 'Saída'),
('entrada', 'Entrada')],
string=u"Tipo da posição")

def _filter_rules(self, fpos_id, type_tax, partner, product, state):
rule_obj = self.env['account.fiscal.position.tax.rule']
Expand Down
21 changes: 10 additions & 11 deletions br_account/views/account_fiscal_position_view.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="br_account_tax_rule_form" model="ir.ui.view">
<field name="name">br_account.tax.rule.form</field>
<field name="model">account.fiscal.position.tax.rule</field>
Expand All @@ -25,7 +24,7 @@
</group>
<group name="icms" attrs="{'invisible': [('domain', 'not in', ('icms', 'simples'))]}">
<group>
<field name="cfop_id" />
<field name="cfop_id" />
<field name="tax_icms_st_id" attrs="{'invisible': [('cst_icms', 'not in', ('10', '30', '70', '90')), ('csosn_icms', 'not in', ('201', '202', '203', '900'))]}" />
<field name="reducao_icms_st" attrs="{'invisible': [('cst_icms', 'not in', ('10', '30', '70', '90')), ('csosn_icms', 'not in', ('201', '202', '203', '900'))]}" />
<field name="tem_difal" />
Expand Down Expand Up @@ -65,7 +64,6 @@
</form>
</field>
</record>

<record id="view_br_account_tax_rule_formtree" model="ir.ui.view">
<field name="name">view.br_account.tax.rule.tree</field>
<field name="model">account.fiscal.position.tax.rule</field>
Expand All @@ -77,12 +75,14 @@
</tree>
</field>
</record>

<record id="br_account_position_form" model="ir.ui.view">
<field name="name">br_account.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">
<field name="auto_apply" position="after">
<field name="fiscal_type"></field>
</field>
<xpath expr="//page[@name='account_mapping']/group" position="before">
<group>
<field name="journal_id" placeholder="Este diário vai ser usado no faturamento" />
Expand All @@ -96,19 +96,19 @@
</group>
</page>
</xpath>
<field name="vat_required" position="attributes" >
<field name="vat_required" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="zip_from" position="attributes" >
<field name="zip_from" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="zip_to" position="attributes" >
<field name="zip_to" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//group/group/div" position="attributes" >
<xpath expr="//group/group/div" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/group/label" position="attributes" >
<xpath expr="//group/group/label" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<page name="tax_mapping" position="attributes">
Expand Down Expand Up @@ -195,5 +195,4 @@
</page>
</field>
</record>

</odoo>
</odoo>
8 changes: 6 additions & 2 deletions br_account/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</xpath>
<field name="fiscal_position_id" position="replace"></field>
<field name="payment_term_id" position="after">
<field name="fiscal_position_id" />
<field name="fiscal_position_id"
domain="[('fiscal_type', '=', 'saida')]"
/>
</field>
<field name="date_invoice" position="before">
<field name="is_eletronic" invisible="1" />
Expand Down Expand Up @@ -130,7 +132,9 @@
</xpath>
<field name="fiscal_position_id" position="replace"></field>
<field name="reference" position="after">
<field name="fiscal_position_id" />
<field name="fiscal_position_id"
domain="[('fiscal_type', '=', 'entrada')]"
/>
</field>
<field name="date_invoice" position="after">
<field name="is_eletronic" invisible="1" />
Expand Down

0 comments on commit 90de80a

Please sign in to comment.