Пример #1
0
    def fields(self):
        # Only users with admin or purchase permission can modify transporters
        user = api.get_current_user(self.store)
        can_modify_transporter = any((
            user.profile.check_app_permission(u'admin'),
            user.profile.check_app_permission(u'purchase'),
        ))

        return collections.OrderedDict(
            client_str=TextField(_("Client"),
                                 proxy=True,
                                 editable=False,
                                 colspan=2),
            transporter_id=PersonField(_("Transporter"),
                                       proxy=True,
                                       person_type=Transporter,
                                       colspan=2,
                                       can_add=can_modify_transporter,
                                       can_edit=can_modify_transporter),
            address=AddressField(_("Address"),
                                 proxy=True,
                                 mandatory=True,
                                 colspan=2),
            was_delivered_check=BoolField(_("Was sent to deliver?")),
            deliver_date=DateField(_("Delivery date"),
                                   mandatory=True,
                                   proxy=True),
            tracking_code=TextField(_("Tracking code"), proxy=True),
            was_received_check=BoolField(_("Was received by client?")),
            receive_date=DateField(_("Receive date"),
                                   mandatory=True,
                                   proxy=True),
            empty=EmptyField(),
        )
Пример #2
0
    def fields(self):
        # Only users with admin or purchase permission can modify transporters
        user = api.get_current_user(self.store)
        can_modify_transporter = any((
            user.profile.check_app_permission(u'admin'),
            user.profile.check_app_permission(u'purchase'),
        ))
        freight_types = [(v, k) for k, v in Delivery.freights.items()]

        return collections.OrderedDict(
            client_str=TextField(_("Client"), proxy=True, editable=False),
            transporter_id=PersonField(_("Transporter"),
                                       proxy=True,
                                       person_type=Transporter,
                                       can_add=can_modify_transporter,
                                       can_edit=can_modify_transporter),
            address=AddressField(_("Address"), proxy=True, mandatory=True),
            is_sent_check=BoolField(_("Was sent to deliver?")),
            send_date=DateField(_("Send date"), mandatory=True, proxy=True),
            tracking_code=TextField(_("Tracking code"), proxy=True),
            freight_type=ChoiceField(_("Freight type"),
                                     proxy=True,
                                     values=freight_types),
            volumes_kind=TextField(_("Volumes kind"), proxy=True),
            volumes_quantity=IntegerField(_("Volumes quantity"), proxy=True),
            is_received_check=BoolField(_("Was received by client?")),
            receive_date=DateField(_("Receive date"),
                                   mandatory=True,
                                   proxy=True),
            empty=EmptyField(),
        )
Пример #3
0
    def fields(self):
        # Only users with admin or purchase permission can modify transporters
        user = api.get_current_user(self.store)
        can_modify_transporter = any((
            user.profile.check_app_permission(u'admin'),
            user.profile.check_app_permission(u'purchase'),
        ))
        freight_types = [(v, k) for k, v in Delivery.freights.items()]
        states = [(v, v) for v in api.get_l10n_field('state').state_list]

        return collections.OrderedDict(
            recipient_str=TextField(_("Recipient"), proxy=True,
                                    editable=False),
            transporter_id=PersonField(_("Transporter"),
                                       proxy=True,
                                       person_type=Transporter,
                                       can_add=can_modify_transporter,
                                       can_edit=can_modify_transporter),
            address=AddressField(_("Address"), proxy=True, mandatory=True),
            is_sent_check=BoolField(_("Was sent to deliver?")),
            send_date=DateField(_("Send date"), mandatory=True, proxy=True),
            tracking_code=TextField(_("Tracking code"), proxy=True),
            freight_type=ChoiceField(_("Freight type"),
                                     proxy=True,
                                     values=freight_types),
            volumes_kind=TextField(_("Volumes kind"), proxy=True),
            volumes_quantity=IntegerField(_("Volumes quantity"), proxy=True),
            volumes_net_weight=NumericField(_("Volumes net weight"),
                                            proxy=True,
                                            digits=3),
            volumes_gross_weight=NumericField(_("Volumes gross weight"),
                                              proxy=True,
                                              digits=3),
            vehicle_license_plate=TextField(_("Vehicle license plate"),
                                            proxy=True),
            vehicle_state=ChoiceField(_("Vehicle state"),
                                      proxy=True,
                                      use_entry=True,
                                      values=states),
            vehicle_registration=TextField(_("Vehicle registration"),
                                           proxy=True),
            is_received_check=BoolField(_("Was received by recipient?")),
            receive_date=DateField(_("Receive date"),
                                   mandatory=True,
                                   proxy=True),
            empty=EmptyField(),
        )
Пример #4
0
 def fields(self):
     return collections.OrderedDict(
         name=TextField(_('Name'), mandatory=True, proxy=True),
         budget=PriceField(_('Budget'), mandatory=True, proxy=True),
         description=MultiLineField(_('Description'),
                                    mandatory=True,
                                    proxy=True),
         is_active=BoolField(_('Active'), proxy=True),
     )
Пример #5
0
 def fields(self):
     return collections.OrderedDict(
         group=GridGroupField(_('Attribute group'),
                              proxy=True,
                              mandatory=True),
         description=TextField(_('Attribute name'),
                               proxy=True,
                               mandatory=True),
         is_active=BoolField(_('Is active'), proxy=True),
     )
Пример #6
0
class OutPaymentEditor(_PaymentEditor):
    payment_type = Payment.TYPE_OUT
    person_attribute = 'recipient'
    person_type = Supplier
    _person_label = _("Recipient:")
    help_section = 'account-payable'
    category_type = PaymentCategory.TYPE_PAYABLE

    fields = _PaymentEditor.fields.copy()
    fields['bill_received'] = BoolField(_('The bill has arrived.'), proxy=True)
Пример #7
0
    def fields(self):
        suppliers = stoq_api.for_combo(self.store.find(Supplier), empty='')

        return collections.OrderedDict(
            item=ChoiceField(_('Item'),
                             mandatory=True,
                             use_entry=True,
                             proxy=True,
                             values=self.items),
            # FIXME change to an appropiate name
            supplier=ChoiceField(_('Supplier'),
                                 mandatory=True,
                                 use_entry=True,
                                 proxy=True,
                                 values=suppliers),
            supplier_order=TextField(_('Supplier Order'),
                                     mandatory=True,
                                     proxy=True),
            is_freebie=BoolField(_('Freebie'), proxy=True),
        )
Пример #8
0
class CostCenterEditor(BaseEditor):
    model_name = _('Cost Center')
    size = (300, -1)
    model_type = CostCenter

    fields = dict(
        name=TextField(_('Name'), mandatory=True, proxy=True),
        budget=PriceField(_('Budget'), mandatory=True, proxy=True),
        description=MultiLineField(_('Description'),
                                   mandatory=True,
                                   proxy=True),
        is_active=BoolField(_('Active'), proxy=True),
    )

    #
    # BaseEditor Hooks
    #

    def create_model(self, store):
        return CostCenter(store=store)
Пример #9
0
 def fields(self):
     fields = super(OutPaymentEditor, self).fields
     fields['bill_received'] = BoolField(_('The bill has arrived.'),
                                         proxy=True)
     return fields