Anand Doshi | 756dca7 | 2013-01-15 18:39:21 +0530 | [diff] [blame] | 1 | # 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 | |
| 17 | from __future__ import unicode_literals |
| 18 | import webnotes |
| 19 | |
| 20 | from buying.utils import get_item_details |
| 21 | |
| 22 | from utilities.transaction_base import TransactionBase |
| 23 | class 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] |