Created
February 27, 2013 19:29
-
-
Save shofetim/5050884 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def save(self, **kwargs): | |
| self.flag_cached_attrs_as_stale() | |
| self.react_to_purchasing_status() | |
| if not self.id: | |
| self.payment_term = self.vendor.payment_term | |
| if self.freight_method in (FREIGHT_CC_FULL, FREIGHT_CC_LTL): | |
| self.common_carrier_pickup_address = self.vendor.any_warehouse_contact | |
| if self.common_carrier_pickup_address: | |
| if(not self.common_carrier_pickup_address.the_same_address_as(self.historic_common_carrier_pickup_address) | |
| and self.phase <= PHASE_RECEIVING): | |
| ccpa = CommonCarrierPickupAddress() | |
| ccpa.copy_address_from(self.common_carrier_pickup_address) | |
| ccpa.save() | |
| self.historic_common_carrier_pickup_address = ccpa | |
| if self.vendor.vendorcontact_set.filter(contact_type='main').exists(): | |
| self.vendor_contact = self.vendor.vendorcontact_set.filter(contact_type='main')[0] | |
| if self.vendor.vendorcontact_set.filter(contact_type='broker').exists(): | |
| self.broker_to_copy = self.vendor.vendorcontact_set.filter(contact_type='broker')[0] | |
| super(Purchase, self).save(**kwargs) | |
| self.update_lines_for_status() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is from /apps/purchasing/models.py in the Purchase class
By the time we get to self.update_lines_for_status() we have purchase lines, but I don't see where they are created?