Browse Source

[11.0][IMP] contract: Improve partner contract smartbutton

pull/132/head
Carlos Dauden 7 years ago
parent
commit
b56be42e2d
  1. 1
      contract/models/account_analytic_account.py
  2. 6
      contract/models/res_partner.py
  3. 5
      contract/views/account_analytic_account_view.xml

1
contract/models/account_analytic_account.py

@ -240,6 +240,7 @@ class AccountAnalyticAccount(models.Model):
invoice = self.env['account.invoice'].create(invoice_vals)
for line in self.recurring_invoice_line_ids:
invoice_line_vals = self._prepare_invoice_line(line, invoice.id)
if invoice_line_vals:
self.env['account.invoice.line'].create(invoice_line_vals)
invoice.compute_taxes()
return invoice

6
contract/models/res_partner.py

@ -18,8 +18,7 @@ class ResPartner(models.Model):
for partner in self:
partner.contract_count = Contract.search_count([
('recurring_invoices', '=', True),
('partner_id', '=', partner.id),
('date_start', '<=', today),
('partner_id', 'child_of', partner.ids),
'|',
('date_end', '=', False),
('date_end', '>=', today),
@ -37,9 +36,10 @@ class ResPartner(models.Model):
self.env.context,
search_default_recurring_invoices=True,
search_default_not_finished=True,
search_default_partner_id=self.id,
default_partner_id=self.id,
default_recurring_invoices=True,
default_pricelist_id=self.pricelist_id.id,
),
domain=[('partner_id', '=', self.id)],
)
return res

5
contract/views/account_analytic_account_view.xml

@ -116,12 +116,11 @@
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_search"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="partner_id" position="after">
<!-- Use other field because partner_id already used -->
<field name="company_id" filter_domain="[('partner_id', 'child_of', self)]"
<field name="partner_id" filter_domain="[('partner_id', 'child_of', self)]"
string="Partner and dependents"/>
</field>
<field name="name" position="after">
<field name="journal_id"/>
<field name="pricelist_id"/>
<separator/>

Loading…
Cancel
Save