blob: c5e00603ccc3d80310e36fbb9ce3e9c336488250 [file] [log] [blame]
Anand Doshi756dca72013-01-15 18:39:21 +05301# ERPNext - web based ERP (http://erpnext.com)
2# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from __future__ import unicode_literals
18import webnotes
19
20from buying.utils import get_item_details
21
22from utilities.transaction_base import TransactionBase
23class BuyingController(TransactionBase):
24 def validate(self):
25 pass
26
27 def update_item_details(self):
28 for item in self.doclist.get({"parentfield": self.fname}):
29 ret = get_item_details({
30 "doctype": self.doc.doctype,
31 "docname": self.doc.name,
32 "item_code": item.item_code,
33 "warehouse": item.warehouse,
34 "supplier": self.doc.supplier,
35 "transaction_date": self.doc.posting_date,
36 "conversion_rate": self.doc.conversion_rate
37 })
38 for r in ret:
39 if not item.fields.get(r):
40 item.fields[r] = ret[r]