Skip to content

Commit

Permalink
Merge branch '11.0' of github.com:ingadhoc/purchase into 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jjscarafia committed Sep 17, 2018
2 parents 27117d7 + 266cd3e commit 31ec223
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ env:


install:
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- sed -i 's/manifest_required_author\=.*/manifest_required_author="ADHOC SA"/g' ${HOME}/maintainer-quality-tools/travis/cfg/travis_run_pylint_pr.cfg
- git clone --depth=1 https://github.com/ingadhoc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly

Expand Down
9 changes: 9 additions & 0 deletions purchase_quotation_products/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ def fields_view_get(self, view_id=None, view_type='form',
if purchase_quotation_products and view_type == 'tree':
doc = etree.XML(res['arch'])

# replace uom_id to uom_po_id field
node = doc.xpath("//field[@name='uom_id']")[0]
replacement_xml = """
<field name="uom_po_id"/>
"""
uom_po_id_node = etree.fromstring(replacement_xml)
node.getparent().replace(node, uom_po_id_node)
res['fields'].update(self.fields_get(['uom_po_id']))

# make all fields not editable
for node in doc.xpath("//field"):
node.set('readonly', '1')
Expand Down
1 change: 1 addition & 0 deletions purchase_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ On purchase orders:
#. Add button to force "invoiced" only for admin with tec features
#. Add button to change the currency and update the prices of the order lines
#. Add a to filter by PO with billable returns.
#. Add link from invoices to the purchase orders that generate it.

On purchase lines:

Expand Down
14 changes: 13 additions & 1 deletion purchase_ux/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api
from odoo import models, fields, api
from ast import literal_eval


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

purchase_order_ids = fields.Many2many(
'purchase.order',
compute='_compute_purchase_orders'
)

@api.multi
def _compute_purchase_orders(self):
for rec in self:
rec.purchase_order_ids = self.env['purchase.order.line'].search(
[('invoice_lines', 'in', rec.invoice_line_ids.ids)]).mapped(
'order_id')

@api.multi
def add_purchase_line_moves(self):
self.ensure_one()
Expand Down
16 changes: 16 additions & 0 deletions purchase_ux/views/account_invoice_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@
</field>
</field>
</record>

<record id="invoice_supplier_form" model="ir.ui.view">
<field name="name">invoice.supplier.form.inherit</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="priority">20</field>
<field name="arch" type="xml">
<notebook>
<page string="Purchase Orders" name="purchase_orders">
<field name="purchase_order_ids" invisible="0"/>
</page>
</notebook>
</field>
</record>
</odoo>


0 comments on commit 31ec223

Please sign in to comment.