Skip to content

Commit

Permalink
Merge pull request #72 from yvaucher/8.0-fix-sale_quotation_sourcing-…
Browse files Browse the repository at this point in the history
…domain-poline

8.0 Set same domain in wizard as on sale order to find po line to fill source_by field
  • Loading branch information
jgrandguillaume committed Nov 26, 2014
2 parents a792b08 + 0aaf34d commit abfe04c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions sale_quotation_sourcing/model/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def _create_sourcing_wizard(self, lines_to_source):
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
manually_sourced = fields.Boolean('Manually Sourced')
sourced_by = fields.Many2one('purchase.order.line', copy=False,
domain="[('product_id', '=', product_id),"
"('state', 'in', ['draft', 'confirmed'])]")
sourced_by = fields.Many2one(
'purchase.order.line', copy=False,
domain="[('product_id', '=', product_id),"
" ('order_id.state', 'in', ['draft', 'confirmed'])]")

@api.multi
def needs_sourcing(self):
Expand Down
2 changes: 1 addition & 1 deletion sale_quotation_sourcing/views/sale_order_sourcing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<tree create='false' editable='bottom'>
<field name='so_line_id' readonly='1'/>
<field name='product_id' readonly='1'/>
<field name='po_line_id' options="{'no_create': True}" domain="[('product_id', '=', product_id), ('state', 'not in', ('done', 'cancel'))]" />
<field name='po_line_id' options="{'no_create': True}" />
</tree>
</field>
</group>
Expand Down
6 changes: 5 additions & 1 deletion sale_quotation_sourcing/wizard/quotation_sourcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ class QuotationLineSource(models.TransientModel):
product_id = fields.Many2one('product.product',
string='Product',
related=('so_line_id', 'product_id'))
po_line_id = fields.Many2one('purchase.order.line', string='Sourced By')
po_line_id = fields.Many2one(
'purchase.order.line',
string='Sourced By',
domain="[('product_id', '=', product_id),"
" ('order_id.state', 'in', ['draft', 'confirmed'])]")

0 comments on commit abfe04c

Please sign in to comment.