[IMP]GOLEM Resource Account : linked to account line, computes account_id from line, improve search and attrs on form

This commit is contained in:
Fabien BOURGEOIS 2018-03-26 12:35:12 +02:00
parent 6dc7c671e5
commit 5307ae37c0
2 changed files with 7 additions and 4 deletions

View File

@ -28,11 +28,12 @@ class GolemResourceReservation(models.Model):
_inherit = 'golem.resource.reservation' _inherit = 'golem.resource.reservation'
resource_product_id = fields.Many2one(related='resource_id.product_tmpl_id') resource_product_id = fields.Many2one(related='resource_id.product_tmpl_id')
invoice_id = fields.Many2one('account.invoice', 'Invoice', index=True)
invoice_state = fields.Selection(related='invoice_id.state', store=True)
invoice_amount_total = fields.Monetary(related='invoice_id.amount_total')
invoice_line_id = fields.Many2one('account.invoice.line') invoice_line_id = fields.Many2one('account.invoice.line')
invoice_line_price_subtotal = fields.Monetary(related='invoice_line_id.price_subtotal') invoice_line_price_subtotal = fields.Monetary(related='invoice_line_id.price_subtotal')
invoice_id = fields.Many2one(related='invoice_line_id.invoice_id',
string='Invoice')
invoice_state = fields.Selection(related='invoice_id.state', store=True)
invoice_amount_total = fields.Monetary(related='invoice_id.amount_total')
currency_id = fields.Many2one(related='invoice_id.currency_id') currency_id = fields.Many2one(related='invoice_id.currency_id')
@api.multi @api.multi

View File

@ -47,6 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<group name="reservation" position="after"> <group name="reservation" position="after">
<group name="invoicing" string="Invoicing" <group name="invoicing" string="Invoicing"
attrs="{'invisible': ['|', ('state', '!=', 'validated'), ('resource_product_id', '=', False)]}"> attrs="{'invisible': ['|', ('state', '!=', 'validated'), ('resource_product_id', '=', False)]}">
attrs="{'invisible': [('invoice_id', '=', False)]}">
<field name="resource_product_id" /> <field name="resource_product_id" />
<field name="invoice_id" /> <field name="invoice_id" />
<field name="invoice_amount_total" /> <field name="invoice_amount_total" />
@ -66,7 +67,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ref="golem_resource.golem_resource_reservation_view_search"/> ref="golem_resource.golem_resource_reservation_view_search"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="state" position="after"> <field name="state" position="after">
<field name="invoice_id" /> <field name="invoice_id" string="Invoice"
filter_domain="[('invoice_id.number', 'ilike', self)]" />
</field> </field>
<filter name="group_state" position="after"> <filter name="group_state" position="after">
<filter name="group_invoice_state" string="Invoice state" <filter name="group_invoice_state" string="Invoice state"