Skip to content

Commit

Permalink
Merge branch '10.0' into 10.0-documentos-relacionados
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaribeiro committed Jan 6, 2017
2 parents c96f8ad + 25c9d39 commit 39e866d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions br_account/models/account_fiscal_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class AccountFiscalPositionTaxRule(models.Model):
class AccountFiscalPosition(models.Model):
_inherit = 'account.fiscal.position'

account_id = fields.Many2one(
'account.account', string="Conta Contábil",
help="Conta Contábil a ser utilizada na fatura.")
note = fields.Text(u'Observações')

icms_tax_rule_ids = fields.One2many(
Expand Down
5 changes: 5 additions & 0 deletions br_account/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ def _onchange_fiscal_document_id(self):
[('fiscal_document_id', '=', self.fiscal_document_id.id)])
self.document_serie_id = series and series[0].id or False

@api.onchange('fiscal_position_id')
def _onchange_br_account_fiscal_position_id(self):
if self.fiscal_position_id and self.fiscal_position_id.account_id:
self.account_id = self.fiscal_position_id.account_id.id

@api.model
def invoice_line_move_line_get(self):
res = super(AccountInvoice, self).invoice_line_move_line_get()
Expand Down
5 changes: 5 additions & 0 deletions br_account/views/account_fiscal_position_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='account_mapping']/group" position="before">
<group>
<field name="account_id" placeholder="Esta conta vai ser usada para faturamento" />
</group>
</xpath>
<field name="vat_required" position="attributes" >
<attribute name="invisible">1</attribute>
</field>
Expand Down
8 changes: 7 additions & 1 deletion br_sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ def _amount_all(self):
for l in order.order_line),
})

@api.multi
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
if self.fiscal_position_id and self.fiscal_position_id.account_id:
res['account_id'] = self.fiscal_position_id.account_id.id
return res

total_bruto = fields.Float(
string='Total Bruto ( = )', readonly=True, compute='_amount_all',
digits=dp.get_precision('Account'), store=True)
Expand Down Expand Up @@ -288,5 +295,4 @@ def _prepare_invoice_line(self, qty):
res['issqn_aliquota'] = issqn.amount or 0.0

res['ii_aliquota'] = ii.amount or 0.0

return res

0 comments on commit 39e866d

Please sign in to comment.