Skip to content

Commit a8a9a41

Browse files
committedOct 26, 2016
[ENH] supplier retention
1 parent 408c858 commit a8a9a41

File tree

11 files changed

+409
-95
lines changed

11 files changed

+409
-95
lines changed
 

‎pabi_account/models/account_invoice.py

+19
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ def onchange_account_id(self, product_id, partner_id, inv_type,
9797
res['value'].update({'name': account.name})
9898
return res
9999

100+
@api.multi
101+
@api.depends('account_id')
102+
def _compute_require_chartfield(self):
103+
""" Overwrite for case Invoice only """
104+
for rec in self:
105+
if 'account_id' in rec and rec.account_id:
106+
report_type = rec.account_id.user_type.report_type
107+
rec.require_chartfield = report_type not in ('asset',
108+
'liability')
109+
else:
110+
rec.require_chartfield = True
111+
if not rec.require_chartfield:
112+
rec.section_id = False
113+
rec.project_id = False
114+
rec.personnel_costcenter_id = False
115+
rec.invest_asset_id = False
116+
rec.invest_construction_phase_id = False
117+
return
118+
100119

101120
class AccountInvoiceTax(models.Model):
102121
_inherit = "account.invoice.tax"

‎pabi_account/views/account_invoice_view.xml

+126-88
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,127 @@
6262
</field>
6363
</record>
6464

65-
# For Receivable side. User want to have a checkbox to show Account column.
66-
<record id="invoice_form" model="ir.ui.view">
65+
<record id="view_invoice_line_show_account_tree" model="ir.ui.view">
66+
<field name="name">view_invoice_line_show_account_tree</field>
67+
<field name="model">account.invoice.line</field>
68+
<field name="arch" type="xml">
69+
70+
<tree string="Invoice lines" editable="bottom">
71+
<field name="sequence" widget="handle"/>
72+
<field name="product_id" invisible="1"/>
73+
<field
74+
name="account_id"
75+
groups="account.group_account_user"
76+
domain="[('type', 'not in', ['view', 'consolidation', 'closed']), ('activity_ids', '=', activity_id and [activity_id] or False)]"
77+
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
78+
<field name="company_id" invisible="1"/>
79+
<field name="account_analytic_id" invisible="1"/>
80+
81+
<!-- Account Budget Activity -->
82+
<field name="activity_group_id"/>
83+
<field name="activity_id"/>
84+
85+
<field name="name"/>
86+
87+
<!-- Chart Fields -->
88+
<field name="require_chartfield" invisible="1"/>
89+
90+
<field name="spa_id" invisible="1"/>
91+
<field name="mission_id" invisible="1"/>
92+
<field name="tag_type_id" invisible="1"/>
93+
<field name="tag_id" invisible="1"/>
94+
95+
<field name="functional_area_id" invisible="1"/>
96+
<field name="program_group_id" invisible="1"/>
97+
<field name="program_id" invisible="1"/>
98+
<field name="project_group_id" invisible="1"/>
99+
<field
100+
name="project_id"
101+
invisible="0"
102+
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
103+
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
104+
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
105+
106+
<field name="org_id" invisible="1"/>
107+
<field name="sector_id" invisible="1"/>
108+
<field name="subsector_id" invisible="1"/>
109+
<field name="division_id" invisible="1"/>
110+
<field
111+
name="section_id"
112+
invisible="0"
113+
attrs="{'required': [('project_id','=',False),('invest_asset_id','=',False),
114+
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
115+
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
116+
<field name="costcenter_id" invisible="1"/>
117+
<field name="taxbranch_id" invisible="1"/>
118+
119+
<field
120+
name="invest_asset_id"
121+
invisible="0"
122+
attrs="{'required': [('section_id','=',False),('project_id','=',False),
123+
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
124+
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
125+
126+
<field name="invest_construction_id" invisible="1"/>
127+
<field
128+
name="invest_construction_phase_id"
129+
invisible="0"
130+
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
131+
('project_id','=',False),('personnel_costcenter_id','=',False),
132+
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
133+
134+
<field
135+
name="personnel_costcenter_id"
136+
invisible="1"
137+
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
138+
('invest_construction_phase_id','=',False),('project_id','=',False),
139+
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
140+
141+
<field name="fund_id" invisible="0"/>
142+
<field name="cost_control_type_id" invisible="1"/>
143+
<field name="cost_control_id" invisible="0"/>
144+
145+
<!-- -->
146+
147+
<field name="quantity"/>
148+
<field name="uos_id" groups="product.group_uom" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, parent.company_id, context)"/>
149+
<field name="price_unit"/>
150+
<field name="discount" groups="sale.group_discount_per_so_line"/>
151+
<field name="invoice_line_tax_id" widget="many2many_tags" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"/>
152+
<field name="price_subtotal"/>
153+
</tree>
154+
155+
</field>
156+
</record>
157+
158+
# User want to have a checkbox to show Account column.
159+
160+
<record id="invoice_supplier_form_show_account" model="ir.ui.view">
161+
<field name="name">invoice.form</field>
162+
<field name="model">account.invoice</field>
163+
<field name="inherit_id" ref="account.invoice_supplier_form"/>
164+
<field name="arch" type="xml">
165+
<xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']" position="before">
166+
<div>
167+
<field name="show_account"/>
168+
<label for="show_account" class="oe_inline"/>
169+
</div>
170+
</xpath>
171+
<xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']" position="attributes">
172+
<attribute name="attrs">{'invisible': [('show_account', '=', True)]}</attribute>
173+
</xpath>
174+
<xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']" position="after">
175+
<field
176+
name="invoice_line_show_account"
177+
attrs="{'invisible': [('show_account', '=', False)]}"
178+
context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type,
179+
'tree_view_ref': 'pabi_account.view_invoice_line_show_account_tree'}"/>
180+
</xpath>
181+
</field>
182+
</record>
183+
184+
185+
<record id="invoice_form_show_account" model="ir.ui.view">
67186
<field name="name">invoice.form</field>
68187
<field name="model">account.invoice</field>
69188
<field name="inherit_id" ref="account.invoice_form"/>
@@ -78,92 +197,11 @@
78197
<attribute name="attrs">{'invisible': [('show_account', '=', True)]}</attribute>
79198
</xpath>
80199
<xpath expr="/form/sheet/notebook/page/field[@name='invoice_line']" position="after">
81-
<field name="invoice_line_show_account" attrs="{'invisible': [('show_account', '=', False)]}" context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type}">
82-
<tree string="Invoice lines" editable="bottom">
83-
<field name="sequence" widget="handle"/>
84-
<field name="product_id" invisible="1"/>
85-
<field
86-
name="account_id"
87-
groups="account.group_account_user"
88-
domain="[('type', 'not in', ['view', 'consolidation', 'closed']), ('activity_ids', '=', activity_id and [activity_id] or False)]"
89-
on_change="onchange_account_id(product_id, parent.partner_id, parent.type, parent.fiscal_position,account_id)"/>
90-
<field name="company_id" invisible="1"/>
91-
<field name="account_analytic_id" invisible="1"/>
92-
93-
<!-- Account Budget Activity -->
94-
<field name="activity_group_id"/>
95-
<field name="activity_id"/>
96-
97-
<field name="name"/>
98-
99-
<!-- Chart Fields -->
100-
<field name="require_chartfield" invisible="1"/>
101-
102-
<field name="spa_id" invisible="1"/>
103-
<field name="mission_id" invisible="1"/>
104-
<field name="tag_type_id" invisible="1"/>
105-
<field name="tag_id" invisible="1"/>
106-
107-
<field name="functional_area_id" invisible="1"/>
108-
<field name="program_group_id" invisible="1"/>
109-
<field name="program_id" invisible="1"/>
110-
<field name="project_group_id" invisible="1"/>
111-
<field
112-
name="project_id"
113-
invisible="0"
114-
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
115-
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
116-
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
117-
118-
<field name="org_id" invisible="1"/>
119-
<field name="sector_id" invisible="1"/>
120-
<field name="subsector_id" invisible="1"/>
121-
<field name="division_id" invisible="1"/>
122-
<field
123-
name="section_id"
124-
invisible="0"
125-
attrs="{'required': [('project_id','=',False),('invest_asset_id','=',False),
126-
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
127-
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
128-
<field name="costcenter_id" invisible="1"/>
129-
<field name="taxbranch_id" invisible="1"/>
130-
131-
<field
132-
name="invest_asset_id"
133-
invisible="0"
134-
attrs="{'required': [('section_id','=',False),('project_id','=',False),
135-
('invest_construction_phase_id','=',False),('personnel_costcenter_id','=',False),
136-
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
137-
138-
<field name="invest_construction_id" invisible="1"/>
139-
<field
140-
name="invest_construction_phase_id"
141-
invisible="0"
142-
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
143-
('project_id','=',False),('personnel_costcenter_id','=',False),
144-
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
145-
146-
<field
147-
name="personnel_costcenter_id"
148-
invisible="1"
149-
attrs="{'required': [('section_id','=',False),('invest_asset_id','=',False),
150-
('invest_construction_phase_id','=',False),('project_id','=',False),
151-
('require_chartfield', '=', True)], 'readonly': [('require_chartfield', '=', False)]}"/>
152-
153-
<field name="fund_id" invisible="0"/>
154-
<field name="cost_control_type_id" invisible="1"/>
155-
<field name="cost_control_id" invisible="0"/>
156-
157-
<!-- -->
158-
159-
<field name="quantity"/>
160-
<field name="uos_id" groups="product.group_uom" on_change="uos_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, parent.company_id, context)"/>
161-
<field name="price_unit"/>
162-
<field name="discount" groups="sale.group_discount_per_so_line"/>
163-
<field name="invoice_line_tax_id" widget="many2many_tags" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]"/>
164-
<field name="price_subtotal"/>
165-
</tree>
166-
</field>
200+
<field
201+
name="invoice_line_show_account"
202+
attrs="{'invisible': [('show_account', '=', False)]}"
203+
context="{'partner_id': partner_id, 'price_type': context.get('price_type') or False, 'type': type,
204+
'tree_view_ref': 'pabi_account.view_invoice_line_show_account_tree'}"/>
167205
</xpath>
168206
</field>
169207
</record>

‎pabi_account_retention/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# -*- coding: utf-8 -*-
2+
from . import models

‎pabi_account_retention/__openerp__.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
{
3+
"name": "NSTDA :: PABI2 - Retention and Retention Clearing",
4+
"summary": "",
5+
"version": "1.0",
6+
"category": "Accounting & Finance",
7+
"description": """
8+
9+
This module do 2 things,
10+
11+
1) On Customer Invoice,
12+
13+
* Adds new receivable type "Retention" in relation with a purcase order.
14+
15+
2) On Supplier invoice
16+
17+
* Allow clearing the retention amount that related to a purchase order, both,
18+
19+
** Customer Invoice from (1)
20+
** Retaintion based on Invoice Plan feature
21+
22+
""",
23+
"website": "https://ecosoft.co.th/",
24+
"author": "Kitti U.",
25+
"license": "AGPL-3",
26+
"application": False,
27+
"installable": True,
28+
"depends": [
29+
"purchase_invoice_plan",
30+
"pabi_account",
31+
],
32+
"data": [
33+
"views/account_invoice_view.xml",
34+
],
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
from . import account_invoice
3+
from . import purchase
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from openerp import models, api, fields
4+
5+
6+
class AccountInvoice(models.Model):
7+
_inherit = "account.invoice"
8+
9+
retention_purchase_id = fields.Many2one(
10+
'purchase.order',
11+
string='Retention on Purchase',
12+
domain="[('partner_id', '=', partner_id),"
13+
"('order_type', '=', 'purchase_order'),"
14+
"('state', 'in', ['done', 'approved'])]",
15+
help="Visible in Customer Invoice only, to create retention invoice",
16+
)
17+
is_retention_return = fields.Boolean(
18+
string='Return Retention on PO',
19+
default=False,
20+
)
21+
retention_return_purchase_id = fields.Many2one(
22+
'purchase.order',
23+
string='Return Retention on Purchase',
24+
help="Visible in Supplier Invoice only, to create return retention "
25+
"consisting of amount from retention invoice, and invoice plan",
26+
)
27+
28+
@api.multi
29+
def onchange_partner_id(self, ttype, partner_id, date_invoice=False,
30+
payment_term=False, partner_bank_id=False,
31+
company_id=False):
32+
res = super(AccountInvoice, self).onchange_partner_id(
33+
ttype, partner_id, date_invoice=date_invoice,
34+
payment_term=payment_term, partner_bank_id=partner_bank_id,
35+
company_id=company_id)
36+
if not res:
37+
res = {}
38+
if 'value' not in res:
39+
res['value'] = {}
40+
if 'domain' not in res:
41+
res['domain'] = {}
42+
43+
res['value'].update({'retention_purchase_id': False,
44+
'retention_return_purchase_id': False,
45+
})
46+
if not partner_id:
47+
domain = [('id', 'in', [])]
48+
res['domain'].update({'retention_return_purchase_id': domain})
49+
else:
50+
domain = [('partner_id', '=', partner_id),
51+
('order_type', '=', 'purchase_order'),
52+
('state', 'in', ['done', 'approved']),
53+
]
54+
# Exclude PO already used.
55+
inv_dom = [('partner_id', '=', partner_id),
56+
('state', 'in', ['open', 'paid'])]
57+
invoices = self.search(
58+
inv_dom + [('type', 'in', ['in_invoice', 'in_refund']),
59+
('is_retention_return', '=', True)])
60+
po_ids = [x.retention_return_purchase_id.id for x in invoices]
61+
domain.append(('id', 'not in', po_ids))
62+
# Only invoices with retention
63+
# 1) Contract Warranty (customer_invoice)
64+
invoices = self.search(
65+
inv_dom + [('type', 'in', ['out_invoice', 'out_refund']),
66+
('retention_purchase_id', '!=', False)])
67+
po_ids = [x.retention_purchase_id.id for x in invoices]
68+
# 2) Retention from Supplier Invoice (invoice plan)
69+
invoices = self.search(
70+
inv_dom + [('type', 'in', ['in_invoice', 'in_refund']),
71+
('amount_retention', '>', 0.0)])
72+
for x in invoices:
73+
if x.purchase_ids:
74+
po_ids += x.purchase_ids._ids
75+
domain.append(('id', 'in', po_ids))
76+
# --
77+
res['domain'].update({'retention_return_purchase_id': domain})
78+
return res
79+
80+
@api.onchange('retention_purchase_id')
81+
def _onchange_retention_purchase_id(self):
82+
self.invoice_line = []
83+
self.invoice_line_show_account = []
84+
if self.retention_purchase_id:
85+
self.show_account = True
86+
retention_line = self.env['account.invoice.line'].new()
87+
retention_line.account_id = \
88+
self.env.user.company_id.account_retention_supplier
89+
retention_line.name = \
90+
self.env.user.company_id.account_retention_supplier.name
91+
retention_line.quantity = 1.0
92+
self.invoice_line_show_account += retention_line
93+
94+
@api.onchange('retention_return_purchase_id')
95+
def _onchange_retention_return_purchase_id(self):
96+
self.invoice_line = []
97+
self.invoice_line_show_account = []
98+
if self.retention_return_purchase_id:
99+
self.show_account = True
100+
account_retention_supplier = \
101+
self.env.user.company_id.account_retention_supplier
102+
purchase = self.retention_return_purchase_id
103+
# 1) Customer Invoice Retention
104+
retention_invoices = self.search(
105+
[('retention_purchase_id', '=', purchase.id),
106+
('state', 'in', ['open', 'paid'])])
107+
for inv in retention_invoices:
108+
for line in inv.invoice_line:
109+
if line.account_id != account_retention_supplier:
110+
continue
111+
return_line = self.env['account.invoice.line'].new()
112+
return_line.account_id = account_retention_supplier
113+
return_line.name = account_retention_supplier.name + \
114+
' (%s)' % (inv.number,)
115+
return_line.quantity = line.quantity
116+
return_line.price_unit = line.price_unit
117+
self.invoice_line_show_account += return_line
118+
# 2) Customer Invoice Retention
119+
invoices = purchase.invoice_ids.filtered(
120+
lambda l: l.amount_retention and l.state in ['open', 'paid'])
121+
for inv in invoices:
122+
return_line = self.env['account.invoice.line'].new()
123+
return_line.account_id = account_retention_supplier
124+
return_line.name = account_retention_supplier.name + \
125+
' (%s)' % (inv.number,)
126+
return_line.quantity = 1.0
127+
return_line.price_unit = inv.amount_retention
128+
self.invoice_line_show_account += return_line
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- coding: utf-8 -*-
2+
from openerp import models, api, fields
3+
4+
5+
class PurchaseOrder(models.Model):
6+
_inherit = "purchase.order"
7+
8+
has_supplier_retention = fields.Boolean(
9+
string='Has Supplier Retention',
10+
compute='_compute_has_supplier_retention',
11+
help="This purchase has uncleared supplier retention, i.e.,\n"
12+
" * Contract Warranty (customer invoices)\n"
13+
" * Retention on Supplier Invoice (invoice plan)\n",
14+
)
15+
16+
@api.multi
17+
@api.depends()
18+
def _compute_has_supplier_retention(self):
19+
Invoice = self.env['account.invoice']
20+
for po in self:
21+
# 1) Contract Warranty (customer_invoice)
22+
count = Invoice.search([('partner_id', '=', po.partner_id.id),
23+
('state', 'in', ['open', 'paid']),
24+
('retention_purchase_id', '=', po.id)],
25+
count=True)
26+
x = 1/0
27+
if count:
28+
print '11111'
29+
print count
30+
po.has_supplier_retention = True
31+
continue
32+
# 2) Retention from Supplier Invoice (invoice plan)
33+
count = Invoice.search([('partner_id', '=', po.partner_id.id),
34+
('amount_retention', '>', 0.0),
35+
('purchase_ids', 'in', [po.id])],
36+
count=True)
37+
if count:
38+
print '2222'
39+
print count
40+
po.has_supplier_retention = True
41+
continue
42+
po.has_supplier_retention = False
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<openerp>
3+
<data>
4+
5+
<record id="invoice_form" model="ir.ui.view">
6+
<field name="name">invoice.form</field>
7+
<field name="model">account.invoice</field>
8+
<field name="inherit_id" ref="account.invoice_form"/>
9+
<field name="arch" type="xml">
10+
<xpath expr="//field[@name='fiscal_position']" position="after">
11+
<field name="retention_purchase_id"/>
12+
</xpath>
13+
</field>
14+
</record>
15+
16+
<record id="invoice_supplier_form" model="ir.ui.view">
17+
<field name="name">invoice.supplier.form</field>
18+
<field name="model">account.invoice</field>
19+
<field name="inherit_id" ref="account.invoice_supplier_form"/>
20+
<field name="arch" type="xml">
21+
<xpath expr="//field[@name='supplier_invoice_number']" position="after">
22+
<label for="is_retention_return"/>
23+
<div>
24+
<field name="is_retention_return" class="oe_inline"/>
25+
<field name="retention_return_purchase_id" class="oe_inline"
26+
attrs="{'invisible': [('is_retention_return', '=', False)], 'required': [('is_retention_return', '=', True)]}"/>
27+
</div>
28+
</xpath>
29+
</field>
30+
</record>
31+
32+
</data>
33+
</openerp>

‎pabi_receivable_type/__openerp__.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Advance Return
1212
* Loan Late Payment Penalty
1313
* Late Delivery Fine
14+
* Retention
1415
1516
In future, there could be more.
1617
""",
@@ -23,6 +24,7 @@
2324
"hr_expense_advance_clearing",
2425
"pabi_purchase_work_acceptance",
2526
"pabi_loan_receivable",
27+
"pabi_account_retention",
2628
],
2729
"data": [
2830
"views/account_invoice_view.xml",

‎pabi_receivable_type/models/account_invoice.py

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class AccountInvoice(models.Model):
1010
[('advance_return', 'Advance Return'),
1111
('late_work_acceptance', 'Late Work Acceptance'),
1212
('loan_late_repayment', 'Late Repayment CD'),
13+
('supplier_retention', 'Supplier Retention'),
1314
],
1415
string='Receivable Type',
1516
copy=False,
@@ -20,3 +21,4 @@ def _onchange_receivable_type(self):
2021
self.advance_expense_id = False
2122
self.late_delivery_work_acceptance_id = False
2223
self.loan_late_payment_invoice_id = False
24+
self.retention_purchase_id = False

‎pabi_receivable_type/views/account_invoice_view.xml

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<openerp>
33
<data>
4-
4+
55
<record id="invoice_form_remove1" model="ir.ui.view">
66
<field name="name">invoice.form</field>
77
<field name="model">account.invoice</field>
88
<field name="inherit_id" ref="hr_expense_advance_clearing.invoice_form"/>
99
<field name="arch" type="xml">
10-
<xpath expr="//field[@name='advance_expense_id']" position="replace" />
10+
<xpath expr="//field[@name='advance_expense_id']" position="replace" />
1111
</field>
1212
</record>
13-
13+
1414
<record id="invoice_form_remove2" model="ir.ui.view">
1515
<field name="name">invoice.form</field>
1616
<field name="model">account.invoice</field>
1717
<field name="inherit_id" ref="pabi_purchase_work_acceptance.invoice_form"/>
1818
<field name="arch" type="xml">
19-
<xpath expr="//field[@name='late_delivery_work_acceptance_id']" position="replace" />
19+
<xpath expr="//field[@name='late_delivery_work_acceptance_id']" position="replace" />
2020
</field>
2121
</record>
22-
22+
2323
<record id="invoice_form_remove3" model="ir.ui.view">
2424
<field name="name">invoice.form</field>
2525
<field name="model">account.invoice</field>
2626
<field name="inherit_id" ref="pabi_loan_receivable.invoice_form"/>
2727
<field name="arch" type="xml">
28-
<xpath expr="//field[@name='loan_late_payment_invoice_id']" position="replace" />
28+
<xpath expr="//field[@name='loan_late_payment_invoice_id']" position="replace" />
2929
</field>
3030
</record>
31-
31+
32+
<record id="invoice_form_remove4" model="ir.ui.view">
33+
<field name="name">invoice.form</field>
34+
<field name="model">account.invoice</field>
35+
<field name="inherit_id" ref="pabi_account_retention.invoice_form"/>
36+
<field name="arch" type="xml">
37+
<xpath expr="//field[@name='retention_purchase_id']" position="replace" />
38+
</field>
39+
</record>
40+
3241
<record id="invoice_form" model="ir.ui.view">
3342
<field name="name">invoice.form</field>
3443
<field name="model">account.invoice</field>
@@ -41,6 +50,7 @@
4150
<field name="advance_expense_id" style="width: 50%%" attrs="{'invisible': [('receivable_type', '!=', 'advance_return')], 'required': [('receivable_type', '=', 'advance_return')]}"/>
4251
<field name="late_delivery_work_acceptance_id" style="width: 50%%" attrs="{'invisible': [('receivable_type', '!=', 'late_work_acceptance')], 'required': [('receivable_type', '=', 'late_work_acceptance')]}"/>
4352
<field name="loan_late_payment_invoice_id" style="width: 50%%" attrs="{'invisible': [('receivable_type', '!=', 'loan_late_repayment')], 'required': [('receivable_type', '=', 'loan_late_repayment')]}"/>
53+
<field name="retention_purchase_id" style="width: 50%%" attrs="{'invisible': [('receivable_type', '!=', 'supplier_retention')], 'required': [('receivable_type', '=', 'supplier_retention')]}"/>
4454
</div>
4555
</xpath>
4656
</field>

0 commit comments

Comments
 (0)
Please sign in to comment.