~romaia/stoq/create-production

« back to all changes in this revision

Viewing changes to stoqlib/domain/exampledata.py

  • Committer: Ronaldo Maia
  • Date: 2011-11-09 18:59:42 UTC
  • mfrom: (4415.1.7 stoq)
  • Revision ID: romaia@async.com.br-20111109185942-mdsxmvk9uw0f0r95
Adicionando testes de qualidade para produtos compostos

Show diffs side-by-side

added added

removed removed

Lines of Context:
491
491
                               description='production',
492
492
                               connection=self.trans)
493
493
 
494
 
    def create_production_item(self, quantity=1):
 
494
    def create_production_item(self, quantity=1, order=None):
495
495
        from stoqlib.domain.product import ProductComponent
496
496
        from stoqlib.domain.production import (ProductionItem,
497
497
                                               ProductionMaterial)
498
498
        product = self.create_product(10)
 
499
        product.addFacet(IStorable, connection=self.trans)
499
500
        component = self.create_product(5)
 
501
        component.addFacet(IStorable, connection=self.trans)
500
502
        ProductComponent(product=product,
501
503
                         component=component,
502
504
                         connection=self.trans)
503
505
 
504
 
        order = self.create_production_order()
 
506
        if not order:
 
507
            order = self.create_production_order()
505
508
        component = list(product.get_components())[0]
506
509
        ProductionMaterial(product=component.component,
507
510
                           order=order,